Copying and pasting trivial H2 content causes a crash in firstPositionInNode
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2014-07-16  Myles C. Maxfield  <mmaxfield@apple.com>
2
3         Copying and pasting trivial H2 content causes a crash in firstPositionInNode
4         https://bugs.webkit.org/show_bug.cgi?id=134897
5
6         Reviewed by Ryosuke Niwa.
7
8         ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder() attempts
9         to move pasted headings out of existed headings, with out regard to if the existing
10         heading is the contenteditable root.
11
12         Test: editing/pasteboard/heading-crash.html
13
14         * editing/ReplaceSelectionCommand.cpp:
15         (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
16
17 2014-07-22  Ryuan Choi  <ryuan.choi@samsung.com>
18
19         Remove dead APIs from TiledBackingStore
20         https://bugs.webkit.org/show_bug.cgi?id=135158
21
22         Reviewed by Gyuyoung Kim.
23
24         setContentsFrozen and related code of TiledBackingStore are not used since Qt port is removed.
25
26         * platform/graphics/TiledBackingStore.cpp:
27         (WebCore::TiledBackingStore::TiledBackingStore):
28         (WebCore::TiledBackingStore::updateTileBuffers):
29         (WebCore::TiledBackingStore::setContentsScale):
30         (WebCore::TiledBackingStore::createTiles):
31         (WebCore::TiledBackingStore::startTileBufferUpdateTimer):
32         (WebCore::TiledBackingStore::startBackingStoreUpdateTimer):
33         (WebCore::TiledBackingStore::commitScaleChange): Deleted.
34         (WebCore::TiledBackingStore::isBackingStoreUpdatesSuspended): Deleted.
35         (WebCore::TiledBackingStore::isTileBufferUpdatesSuspended): Deleted.
36         (WebCore::TiledBackingStore::setContentsFrozen): Deleted.
37         * platform/graphics/TiledBackingStore.h:
38         (WebCore::TiledBackingStore::contentsFrozen): Deleted.
39
40 2014-07-22  Alex Christensen  <achristensen@webkit.org>
41
42         Fix window-inactive css selectors when using querySelector.
43         https://bugs.webkit.org/show_bug.cgi?id=135149
44
45         Reviewed by Tim Horton.
46
47         Test: fast/selectors/querySelector-window-inactive.html
48
49         * css/SelectorChecker.cpp:
50         (WebCore::SelectorChecker::checkOne):
51         Removed default and implemented case PseudoClassWindowInactive.
52
53 2014-07-22  Tim Horton  <timothy_horton@apple.com>
54
55         REGRESSION (r171016): Reproducible infinite spin selecting phone number
56         https://bugs.webkit.org/show_bug.cgi?id=135183
57         <rdar://problem/17727342>
58
59         Reviewed by Ryosuke Niwa.
60
61         * editing/Editor.cpp:
62         (WebCore::Editor::scanRangeForTelephoneNumbers):
63         Make use of TextIterator::subrange, which knows how to make a subrange from character positions,
64         instead of assuming that our character positions translate directly to positions in the incoming range.
65         Make use of DocumentMarkerController::addMarker, which takes a range and applies the marker to
66         all text nodes inside the range as appropriate.
67         Fix naming of the shadowed 'length' local.
68         Fix a typo in the comment.
69
70 2014-07-22  Myles C. Maxfield  <mmaxfield@apple.com>
71
72         [iOS] [OSX] Don't transcode WOFF on platforms that support it natively
73         https://bugs.webkit.org/show_bug.cgi?id=134904
74
75         Reviewed by Andreas Kling.
76
77         No new tests because there is no behavior change.
78
79         * loader/cache/CachedFont.cpp:
80         (WebCore::CachedFont::ensureCustomFontData):
81
82 2014-07-22  peavo@outlook.com  <peavo@outlook.com>
83
84         [Win] Crash after plugin is unloaded.
85         https://bugs.webkit.org/show_bug.cgi?id=119044
86
87         Reviewed by Darin Adler.
88
89         We need to invalidate all runtime objects when a plugin view is destroyed, in case the plugin is unloaded,
90         and one of these runtime objects accesses the plugin function table upon destruction afterwards, which will cause a crash.
91         If we use the weak pointer to the runtime object when invalidating, it will be null if it's in the WeakImpl::Dead state.
92         This means the runtime object will not be invalidated, possibly causing a crash if the plugin is unloaded.
93         It should be safe to use the raw pointer to the runtime object when invalidating, since finalized runtime objects
94         will be removed from the set of runtime objects in the method RootObject::finalize().
95
96         * bridge/runtime_root.cpp:
97         (JSC::Bindings::RootObject::invalidate): Make sure all runtime objects are invalidated by getting the raw runtime object pointer from the hash key.
98
99 2014-07-22  Enrica Casucci  <enrica@apple.com>
100
101         REGRESSION (WebKit2): Selection inside accelerated overflow:scroll doesn't track scrolling.
102         https://bugs.webkit.org/show_bug.cgi?id=135180
103         <rdar://problem/16721055>
104
105         Reviewed by Simon Fraser.
106
107         AsyncScrollingCoordinator will force a selection update on iOS
108         when scrolling terminates in an overflow scroll.
109
110         * loader/EmptyClients.h:
111         * page/EditorClient.h:
112         * page/scrolling/AsyncScrollingCoordinator.cpp:
113         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
114         * page/scrolling/ScrollingTree.h:
115         (WebCore::ScrollingTree::scrollingTreeNodeWillStartScroll):
116         (WebCore::ScrollingTree::scrollingTreeNodeDidEndScroll):
117
118 2014-07-22  Myles C. Maxfield  <mmaxfield@apple.com>
119
120         [Mac] Cocoa throws exception when the return type of NSAccessibilityLinkedUIElementsAttribute is not an array
121         https://bugs.webkit.org/show_bug.cgi?id=135165
122
123         Reviewed by Simon Fraser.
124
125         Return an empty array instead of nil.
126
127         Updated tests.
128
129         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
130         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
131
132 2014-07-22  Commit Queue  <commit-queue@webkit.org>
133
134         Unreviewed, rolling out r171357.
135         https://bugs.webkit.org/show_bug.cgi?id=135173
136
137         broke Windows build. (Requested by bfulgham on #webkit).
138
139         Reverted changeset:
140
141         "[Win] Fix Crash when handling Legible Output callbacks"
142         https://bugs.webkit.org/show_bug.cgi?id=134946
143         http://trac.webkit.org/changeset/171357
144
145 2014-07-22  Brent Fulgham  <bfulgham@apple.com>
146
147         [Win] Fix Crash when handling Legible Output callbacks
148         https://bugs.webkit.org/show_bug.cgi?id=134946
149
150         Reviewed by Dean Jackson.
151
152         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
153         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Remove
154         Windows-specific 'ASSERT_NOT_REACHED' code path.
155         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
156         (WebCore::createLegibleOutputSubtypes): Added.
157         (WebCore::AVFWrapper::createPlayerItem): Updated to request native
158         samples from AVFoundationCF.
159
160 2014-07-21  Sam Weinig  <sam@webkit.org>
161
162         [Cocoa] WKScriptMessageHandlers don't seem to function properly after navigating
163         https://bugs.webkit.org/show_bug.cgi?id=135148
164
165         Reviewed by Geoffrey Garen.
166
167         The "webkit" property on the window was not getting installed for subsequent
168         loads due to intricate dance playing setting the JSDOMWindow where the DOMWindow
169         object is not yet in a Frame when the JSDOMWindow is created. Since we were
170         adding the "webkit" property on construction, the property was returning null
171         thinking it had no Frame and was in a bad state. We can fix this by making the
172         "webkit" property behave like all the other window properties moving its getting
173         to JSDOMWindow::getOwnPropertySlot.
174
175         Added API test (WebKit2Cocoa/UserContentController).
176
177         * bindings/js/JSDOMWindowBase.cpp:
178         (WebCore::JSDOMWindowBase::finishCreation):
179         * bindings/js/JSDOMWindowCustom.cpp:
180         (WebCore::jsDOMWindowWebKit):
181         (WebCore::JSDOMWindow::getOwnPropertySlot):
182
183 2014-07-22  Brent Fulgham  <bfulgham@apple.com>
184
185         [Win] Fix Leak in WebCore::createGlobalImageFileDescriptor 
186         https://bugs.webkit.org/show_bug.cgi?id=134423
187         <rdar://problem/17492758>
188
189         Reviewed by Geoffrey Garen.
190
191         * platform/win/PasteboardWin.cpp:
192         (WebCore::createGlobalImageFileDescriptor): Unlock and release the
193         HGLOBAL when exiting early.
194
195 2014-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
196
197         Clicking on links while accessibility is enabled sometimes crashes
198         https://bugs.webkit.org/show_bug.cgi?id=135074
199
200         Reviewed by Chris Fleizach.
201
202         When an accessibility request comes in from the system, we call updateBackingStore() on the
203         relevant AccessibilityObject, which triggers a relayout of the entire document. This relayout
204         might delete that accessibility node and its parent, which would cause the node to be deleted.
205         After the stack unwinds, we then call a member function on the node without checking for this
206         condition.
207
208         Test: accessibility/parent-delete.html
209
210         * accessibility/AccessibilityObject.cpp:
211         (WebCore::AccessibilityObject::updateBackingStore): Retain the node for the duration of the
212         function.
213
214 2014-07-22  Jeremy Jones  <jeremyj@apple.com>
215
216         Don't create new UIWindow for video fullscreen.
217         https://bugs.webkit.org/show_bug.cgi?id=135038
218
219         Reviewed by Darin Adler.
220
221         * WebCore.exp.in:
222         * platform/ios/WebVideoFullscreenControllerAVKit.h: use UIView instead of UIScreen.
223         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
224         (-[WebVideoFullscreenController enterFullscreen:]): provide parent UIView.
225         * platform/ios/WebVideoFullscreenInterfaceAVKit.h: remove UIWindow.
226         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: 
227         (WebVideoFullscreenInterfaceAVKit::setupFullscreen): ditto 
228         (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen): ditto
229         (WebVideoFullscreenInterfaceAVKit::invalidate): ditto
230         (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): ditto
231
232 2014-07-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
233
234         [GTK] Rollout r170529 due to ~10% performance regression on the
235         perf test Animation/balls.
236         https://bugs.webkit.org/show_bug.cgi?id=134972
237
238         Reviewed by Martin Robinson.
239
240         Reverted changeset:
241         "Increase priority on SharedTimer source."
242         https://trac.webkit.org/r170529
243
244 2014-07-18  Dirk Schulze  <krit@webkit.org>
245
246         Turn width/height to presentation attributes
247         https://bugs.webkit.org/show_bug.cgi?id=135046
248
249         Reviewed by Dean Jackson.
250
251         The elements <svg>, <image>, <pattern>, <mask> and <foreignObject> have the
252         'width' and 'height' attributes. So far they can just be set by SVG DOM or
253         setAttribute. Furthermore, animations just work with SVG Animation - No support
254         for CSS Animations and CSS Transitions. We started to turn the width and height
255         attributes on SVG roots to presentation attributes already. A presentation
256         attribute is a CSS property that can also be set by DOM (or now by SVG DOM).
257
258         This patch turns all width and height attributes to presentation attributes. It
259         basically allows authors to style width and height with CSS as well. Width and
260         height can now be set with CSS style sheets and can be animated with CSS.
261
262         To some degree it made it possible to remove code duplication. However, since
263         SVG DOM requires us to use SVGLength types and since we did not turn all
264         SVG attributes to the CSS length values (and our internal Length struct) yet,
265         we still need a hybrid - a bridge between SVGLength (for SVG DOM) and Length (for
266         RenderStyle). Once we move all attributes to use the Length struct, we can make SVGLength
267         a wrapper for Length and can move more code to the render tree.
268
269         The current challenge is to synchronize SVG DOM, normal DOM and RenderStyle.
270         With this patch we handle most part in RenderStyle. SVG DOM changes are
271         synchronized to DOM and RenderStyle will call needsStyleRecalc. Furthermore,
272         SVG Animations will continue to animate the SVG DOM (and synchronize the changes
273         back to RenderStyle) if the element has a JS property for the currently animated
274         attribute.
275
276         Short example:
277
278             <rect>
279                 <animate attributeName="width">
280             </rect>
281
282         The <rect> element has the SVG DOM property 'width'. Therefore, we animate the SVG DOM
283         property and synchronize RenderStyle.
284
285             <ellipse>
286                 <animate attributeName="width">
287             </ellipse>
288
289         The <ellipse> element does NOT have the SVG DOM property 'width'. Therefore, we
290         animate the CSS property directly. With synchronizing RenderStyle in all cases, we
291         make sure that the CSS cascade works even on animating on multiple SVG hierarchy
292         levels (animation of 'width' on <g> and inheriting the property value on a child
293         <rect>).
294
295         With using presentation attributes, we also inherit the CSS property parsing for
296         SVG attributes. <rect width="  100px  "> is possible now. (Note the trailing whitespaces.)
297         This follows a recent resolution of the SVG WG.
298
299         Since we turned width and height to presentation attributes, the layout optimization
300         selfHasRelativeLengths() in the DOM can't be used anymore. selfHasRelativeLengths() was
301         intended to solve a problem where we did not layout relatively position/sized elements
302         when the parent changes its size. However, as a side effect it did not call layout
303         for absolutely positioned/sized elements since the layout does not change. I run
304         all performance tests that we have and even wrote a test with hundreds of elements
305         that would be affected by this optimization. The differences were inside the sigma
306         of a normal test run. (Means I couldn't measure a performance difference.)
307         Therefore, it is not worth it to keep the "optimization" around and I will probably
308         remove it entirely for all basic shapes but <path> and <polygon> in future patches.
309
310         Tests: svg/css/parse-height.html
311                svg/css/parse-width.html
312                svg/css/width-height-presentation-attribute-expected.svg
313                svg/css/width-height-presentation-attribute.svg
314
315         * css/CSSComputedStyleDeclaration.cpp:
316         (WebCore::ComputedStyleExtractor::propertyValue): We never calculated the computed
317             value of width/height for SVG elements and returned auto instead. This is based
318             on a rule of CSS 2 and needs to be fixed in CSS3.
319         * css/DeprecatedStyleBuilder.cpp:
320         (WebCore::ApplyPropertyLength::applyValue): Length always incorporates the zoom level.
321             In SVG we still apply the zoom after all operations by scaling the context. We need
322             to take this in account for Length and don't apply zoom on SVG inline elements.
323         * css/StyleResolver.cpp:
324         (WebCore::StyleResolver::useSVGZoomRulesForLength):
325             See above.
326         * css/StyleResolver.h:
327         * rendering/svg/RenderSVGRect.cpp:
328         (WebCore::RenderSVGRect::updateShapeFromElement): Do not call width() and height() on
329             SVG DOM but use the values of RenderStyle instead.
330         * rendering/svg/SVGPathData.cpp:
331         (WebCore::updatePathFromRectElement): Ditto.
332         * svg/SVGAnimateElement.cpp:
333         (WebCore::SVGAnimateElement::resetAnimatedType): We need to differ between CSS properties
334             with and without SVG DOM on the current element. In the later case we animate the 
335             SVG DOM and need to synch RenderStyle.
336         (WebCore::SVGAnimateElement::clearAnimatedType): Ditto.
337         (WebCore::SVGAnimateElement::applyResultsToTarget): Ditto.
338         * svg/SVGAnimationElement.cpp:
339         (WebCore::SVGAnimationElement::isTargetAttributeCSSProperty): This checks if the CSS property
340             has to be synched with SVG DOM.
341         (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
342         * svg/SVGAnimationElement.h:
343         * svg/SVGElement.cpp:
344         (WebCore::populateAttributeNameToCSSPropertyIDMap): Add width and heigth to the CSS property
345             list for presentation attributes.
346         (WebCore::populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): CSS properties with
347             SVG DOM synchronization need to be treated differently. Collect them in a separate map.
348         (WebCore::cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Caller for the map.
349         (WebCore::SVGElement::animatedPropertyTypeForAttribute): We need to check both maps here:
350             CSS properties and CSS properties with SVG DOM synch.
351         (WebCore::SVGElement::isAnimatableCSSProperty): Ditto.
352         (WebCore::SVGElement::isPresentationAttributeWithSVGDOM): Just return true if the property name
353             is in the map of properties with SVG DOM for the current element.
354         * svg/SVGElement.h:
355         (WebCore::SVGElement::invalidateSVGPresentationAttributeStyle): Call needsStyleRecalc.
356         * svg/SVGFilterElement.cpp: Make width/height presentation attribute.
357         (WebCore::SVGFilterElement::svgAttributeChanged):
358         (WebCore::SVGFilterElement::selfHasRelativeLengths): Deleted.
359         * svg/SVGFilterElement.h: Ditto.
360         * svg/SVGForeignObjectElement.cpp:
361         (WebCore::SVGForeignObjectElement::svgAttributeChanged):
362         (WebCore::SVGForeignObjectElement::selfHasRelativeLengths): Deleted.
363         * svg/SVGForeignObjectElement.h:
364         * svg/SVGImageElement.cpp: Ditto.
365         (WebCore::SVGImageElement::svgAttributeChanged):
366         (WebCore::SVGImageElement::isPresentationAttribute): Deleted.
367         (WebCore::SVGImageElement::collectStyleForPresentationAttribute): Deleted.
368         (WebCore::SVGImageElement::selfHasRelativeLengths): Deleted.
369         * svg/SVGImageElement.h:
370         * svg/SVGLength.h: Transform an Length value to an absolute value by taking the SVG viewport
371             into account. (An SVG viewport is not the same as the CSS viewport.)
372         * svg/SVGLengthContext.cpp: Ditto.
373         (WebCore::SVGLengthContext::valueForLength):
374         * svg/SVGLengthContext.h:
375         * svg/SVGMaskElement.cpp: Make width/height presentation attribute.
376         (WebCore::SVGMaskElement::svgAttributeChanged):
377         (WebCore::SVGMaskElement::selfHasRelativeLengths): Deleted.
378         * svg/SVGMaskElement.h:
379         * svg/SVGPatternElement.cpp: Ditto.
380         (WebCore::SVGPatternElement::svgAttributeChanged):
381         (WebCore::SVGPatternElement::selfHasRelativeLengths): Deleted.
382         * svg/SVGPatternElement.h:
383         * svg/SVGRectElement.cpp: Ditto.
384         (WebCore::SVGRectElement::svgAttributeChanged):
385         (WebCore::SVGRectElement::selfHasRelativeLengths): Deleted.
386         * svg/SVGRectElement.h:
387         * svg/SVGSVGElement.cpp: Ditto.
388         (WebCore::SVGSVGElement::svgAttributeChanged): Clean up redundant layout calls.
389         (WebCore::SVGSVGElement::isPresentationAttribute): Deleted.
390         (WebCore::SVGSVGElement::collectStyleForPresentationAttribute): Deleted.
391         * svg/SVGSVGElement.h:
392         * svg/properties/SVGAnimatedProperty.cpp: Synchronize SVG DOM with DOM.
393         (WebCore::SVGAnimatedProperty::commitChange):
394
395 2014-07-22  Adrian Perez de Castro  <aperez@igalia.com>
396
397         [GStreamer] [GTK] WebKit does not build with GStreamer 1.4
398         https://bugs.webkit.org/show_bug.cgi?id=135114
399
400         Reviewed by Philippe Normand.
401
402         Fix build with GStreamer 1.4
403
404         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
405         Change GstMpegTs-prefixed types to use the GstMpegts prefix.
406         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
407         (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
408         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
409         Ditto.
410
411 2014-07-21  Benjamin Poulain  <bpoulain@apple.com>
412
413         [iOS][WK2] Improve event throttling for Scroll Events
414         https://bugs.webkit.org/show_bug.cgi?id=135082
415         <rdar://problem/17445266>
416
417         Reviewed by Simon Fraser.
418
419         This patch is composed of two parts. The first part in the WebKit layer
420         track an approximate measurement of the main thread responsiveness.
421         The second part in WebCore use that information to avoid sending events
422         if a page is unresponsive.
423
424         In WebCore, this patch only consider scroll events so far. Hopefully the concept
425         should be easy to generalize.
426
427         * loader/EmptyClients.h:
428         * page/ChromeClient.h:
429         Chrome client provides us with one information: how long an incoming event should be delayed.
430         Every port is free to implement whatever logic is suitable for them.
431
432         * page/FrameView.cpp:
433         (WebCore::FrameView::FrameView):
434         (WebCore::FrameView::reset):
435         (WebCore::FrameView::delayedScrollEventTimerFired):
436         (WebCore::FrameView::scrollPositionChanged):
437         (WebCore::FrameView::sendScrollEvent):
438         * page/FrameView.h:
439         Scroll events do not have any associated information so they can be coalesced by just skipping
440         all input hapenning during the throttling delay.
441
442         The implementation is done by using a timer to delay the events.
443
444 2014-07-21  Tim Horton  <timothy_horton@apple.com>
445
446         Avoid putting empty-sized surfaces into IOSurfacePool
447         https://bugs.webkit.org/show_bug.cgi?id=135136
448
449         Reviewed by Simon Fraser.
450
451         * platform/graphics/cg/IOSurfacePool.cpp:
452         (WebCore::IOSurfacePool::addSurface):
453         Avoid adding 0x0 surfaces to the pool, because they will wreak havoc
454         when their size is used as the key in the CachedSurfaceMap.
455         Additionally, avoid any empty sizes, because they're just pointless.
456
457 2014-07-21  Beth Dakin  <bdakin@apple.com>
458
459         WK1 should always setAcceleratedCompositingForFixedPositionEnabled(true) on 
460         Yosemite
461         https://bugs.webkit.org/show_bug.cgi?id=135135
462
463         Reviewed by Darin Adler.
464
465         This patch gets rid of the ChromeClient function that was introduced with 
466         http://trac.webkit.org/changeset/171308 We’ll just enable the Setting instead.
467         * css/StyleResolver.cpp:
468         (WebCore::StyleResolver::adjustRenderStyle):
469         (WebCore::fixedPositionCreatesStackingContext): Deleted.
470         * page/ChromeClient.h:
471         (WebCore::ChromeClient::requiresAcceleratedCompositingForViewportConstrainedPosition): Deleted.
472         * rendering/RenderLayerCompositor.cpp:
473         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
474
475 2014-07-21  Simon Fraser  <simon.fraser@apple.com>
476
477         [iOS WK2] Turn off position:fixed behavior when the keyboard is up
478         https://bugs.webkit.org/show_bug.cgi?id=132537
479
480         Reviewed by Benjamin Poulain.
481
482         Export RenderObject::localToContainerPoint().
483
484         * WebCore.exp.in:
485
486 2014-07-21  Jer Noble  <jer.noble@apple.com>
487
488         [MSE] YouTube video decode error when variant-switching
489         https://bugs.webkit.org/show_bug.cgi?id=135128
490
491         Reviewed by Brent Fulgham.
492
493         Test: media/media-source/media-source-overlapping-decodetime.html
494
495         When variant-switching, the situation can arise where an existing sample with a presentation
496         timestamp of N and a decode timestamp of M, and a new sample with a presentation timestamp > N
497         and the same decode timestamp of M, will keep the new sample from being added to the SampleMap.
498         This can result in a decode error when samples depending on that new, missing sample are enqueued.
499
500         The MSE spec is silent on the issue of overlapping decode timestamps. However, it guarantees that
501         presentation timestamps are non-overlapping. So instead of using just the decode timestamp as a key
502         for storing the samples in decode order, use both the decode timestamp and the presentation timestamp.
503         That ensures that samples with different presentation times but equal decode times are both inserted
504         into the decode queue, and in the correct order.
505
506         * Modules/mediasource/SampleMap.cpp:
507         (WebCore::SampleIsRandomAccess::operator()): Update the parameter type to match the new KeyType.
508         (WebCore::SampleMap::addSample): Pass both decodeTime and presentationTime as the key to decodeOrder.
509         (WebCore::SampleMap::removeSample): Ditto.
510         (WebCore::DecodeOrderSampleMap::findSampleWithDecodeKey): Renamed from findSampleWithDecodeTime.
511         (WebCore::DecodeOrderSampleMap::reverseFindSampleWithDecodeKey): renamed from reverseFindSampleWithDecodeTime.
512         (WebCore::DecodeOrderSampleMap::findSyncSamplePriorToPresentationTime): Use renamed version of above.
513         (WebCore::DecodeOrderSampleMap::findSyncSampleAfterPresentationTime): Ditto.
514         (WebCore::DecodeOrderSampleMap::findDependentSamples): Ditto.
515         (WebCore::DecodeOrderSampleMap::findSampleWithDecodeTime): Deleted.
516         (WebCore::DecodeOrderSampleMap::reverseFindSampleWithDecodeTime): Deleted.
517         * Modules/mediasource/SampleMap.h:
518         * Modules/mediasource/SourceBuffer.cpp:
519         (WebCore::SourceBuffer::removeCodedFrames): Ditto.
520         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
521         (WebCore::SourceBuffer::reenqueueMediaForTime): Ditto.
522
523 2014-07-21  Andy Estes  <aestes@apple.com>
524
525         [iOS] Handle QuickLook ResourceLoaders in the web process
526         https://bugs.webkit.org/show_bug.cgi?id=135113
527
528         Reviewed by David Kilzer.
529
530         No new tests. QuickLook is not testable from WebKit.
531
532         * WebCore.exp.in:
533         * loader/ResourceLoadScheduler.cpp:
534         (WebCore::ResourceLoadScheduler::maybeLoadQuickLookResource): Start loading the ResourceLoader if it is for a QuickLook resource.
535         * loader/ResourceLoadScheduler.h:
536
537 2014-07-21  Alexey Proskuryakov  <ap@apple.com>
538
539         Case sensitive file system build fix.
540
541         * page/scrolling/ScrollingStateTree.cpp:
542
543 2014-07-21  Beth Dakin  <bdakin@apple.com>
544
545         Put position:fixed elements into layers when a WK1 view is layer-backed
546         https://bugs.webkit.org/show_bug.cgi?id=135075
547
548         Reviewed by Darin Adler.
549
550         This patch adds a new ChromeClient function called 
551         requiresAcceleratedCompositingForViewportConstrainedPosition(). Since a view can 
552         go in and out of layer backing, we need a ChromeClient method that can be 
553         dynamically re-evaluated rather than using the existing settings for enabling 
554         accelerated fixed and fixed that creates a stacking context.
555
556         Ensure that fixed elements create a stacking context when 
557         requiresAcceleratedCompositingForViewportConstrainedPosition is true.
558         * css/StyleResolver.cpp:
559         (WebCore::StyleResolver::adjustRenderStyle):
560
561         New ChromeClient function.
562         * page/ChromeClient.h:
563
564 2014-07-21  Simon Fraser  <simon.fraser@apple.com>
565
566         Add helper functions to dump the scrolling state tree from the debugger
567         https://bugs.webkit.org/show_bug.cgi?id=135101
568
569         Reviewed by Darin Adler.
570
571         Add debug-only showScrollingStateTree() functions that take a ScrollingStateTree* and ScrollingStateNode*
572         for use while debugging.
573
574         * page/scrolling/ScrollingStateTree.cpp:
575         (showScrollingStateTree):
576         * page/scrolling/ScrollingStateTree.h:
577
578 2014-07-20  Simon Fraser  <simon.fraser@apple.com>
579
580         [iOS WK1] Single touch div scrolling doesn't work in framesets (breaks Word previews)
581         https://bugs.webkit.org/show_bug.cgi?id=135103
582         <rdar://problem/11830219>
583
584         Reviewed by Darin Adler.
585
586         After r166117 all layer flushing starts on the root frame; we no longer flush layers
587         for each frame during painting. However, flushing GraphicsLayers can set some state
588         on a subframe RenderLayerCompositor that is now never processed, which breaks scroll
589         layer registration.
590         
591         Fix by doing a walk of the Frame tree, and calling didFlushLayers() on subframe RenderLayerCompositors
592         before calling didFlushLayers() on self.
593
594         * rendering/RenderLayerCompositor.cpp:
595         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
596         (WebCore::RenderLayerCompositor::didFlushLayers):
597         (WebCore::RenderLayerCompositor::notifySubframesAfterLayerFlush):
598         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers): Drive-by nullptr.
599         * rendering/RenderLayerCompositor.h:
600
601 2014-07-21  Eric Carlson  <eric.carlson@apple.com>
602
603         [iOS] a Paused media session is not active
604         https://bugs.webkit.org/show_bug.cgi?id=135108
605
606         Reviewed by Darin Adler.
607
608         Activating the shared AudioSession will pause audio playing in another application,
609         so only report a Playing media sessions as active.
610
611         * platform/audio/MediaSessionManager.cpp:
612         * platform/audio/MediaSessionManager.h:
613         (WebCore::MediaSessionManager::activeAudioSessionRequired): Renamed from hasActive to make
614         clear what it does. Only return true for a session that is Playing.
615
616         * platform/audio/mac/MediaSessionManagerMac.cpp:
617         (MediaSessionManager::updateSessionState): hasActive renamed to activeAudioSessionRequired.
618
619 2014-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
620
621         Unreviewed. Update GObject DOM bindings test results after r171285.
622
623         * bindings/scripts/test/GObject/WebKitDOMTestActiveDOMObject.cpp:
624         * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp:
625         * bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.cpp:
626         * bindings/scripts/test/GObject/WebKitDOMTestEventConstructor.cpp:
627         * bindings/scripts/test/GObject/WebKitDOMTestEventTarget.cpp:
628         * bindings/scripts/test/GObject/WebKitDOMTestException.cpp:
629         * bindings/scripts/test/GObject/WebKitDOMTestGenerateIsReachable.cpp:
630         * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp:
631         * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp:
632         * bindings/scripts/test/GObject/WebKitDOMTestNamedConstructor.cpp:
633         * bindings/scripts/test/GObject/WebKitDOMTestNode.cpp:
634         * bindings/scripts/test/GObject/WebKitDOMTestNondeterministic.cpp:
635         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
636         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructors.cpp:
637         * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp:
638         * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp:
639         * bindings/scripts/test/GObject/WebKitDOMattribute.cpp:
640         * bindings/scripts/test/GObject/WebKitDOMreadonly.cpp:
641
642 2014-07-20  Pratik Solanki  <psolanki@apple.com>
643
644         Reduce the chances of a race condition when sharing SharedBuffer
645         https://bugs.webkit.org/show_bug.cgi?id=135060
646         <rdar://problem/17729444>
647
648         Reviewed by Darin Adler.
649
650         We currently pass a SharedBuffer wrapped in WebCoreSharedBufferData to ImageIO for image
651         decoding. This is not thread safe since ImageIO will access this buffer on a separate
652         thread. We access SharedBuffer::buffer() on the other thread which resizes the Vector
653         m_buffer if m_size is greater than the vector size. Since the code in SharedBuffer::append()
654         sets m_size before appending the data to the buffer, m_size is out of sync with the m_buffer
655         size for the entire duration of the Vector append which could be doing a lot of copying if
656         the resource is large. While this change does not fix the race condition, we can at least
657         reduce the chances of SharedBuffer::buffer() calling resize() by setting m_size after the
658         cector has finished appending.
659
660         No new tests because no functional changes.
661
662         * platform/SharedBuffer.cpp:
663         (WebCore::SharedBuffer::append):
664
665 2014-07-20  Jeremy Jones  <jeremyj@apple.com>
666
667         Fix test crashes when cloning video layer since r171286
668         https://bugs.webkit.org/show_bug.cgi?id=135112
669
670         Unreviewed. Fix crashing tests by conditionalizing inline video layer change.
671         compositing/video/video-reflection.html [ Crash ]
672         media/video-layer-crash.html [ Crash ]
673
674         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: add conditional
675         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: ditto
676         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): ditto
677         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): ditto
678         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer): ditto
679
680 2014-07-20  Jeremy Jones  <jeremyj@apple.com>
681
682         Disable ff/rw based on canPlayFastForward and canPlayFastRewind.
683         https://bugs.webkit.org/show_bug.cgi?id=134894
684
685         Reviewed by Darin Adler.
686
687         * WebCore.exp.in: add symbol for canPlayFastReverse
688         * html/HTMLMediaElement.cpp: Add two new accessors
689         (WebCore::HTMLMediaElement::nextScanRate): possibly limit scanRate
690         (WebCore::HTMLMediaElement::canPlayFastForward): added
691         (WebCore::HTMLMediaElement::canPlayFastReverse): added
692         * html/HTMLMediaElement.h: declare two new methods
693         * platform/graphics/MediaPlayer.cpp: Plumb through two new accessors
694         (WebCore::MediaPlayer::maxFastForwardRate): added
695         (WebCore::MediaPlayer::minFastReverseRate): added
696         * platform/graphics/MediaPlayer.h: Declare new methods
697         * platform/graphics/MediaPlayerPrivate.h: Added two new methods.
698         (WebCore::MediaPlayerPrivateInterface::maxFastForwardRate): added
699         (WebCore::MediaPlayerPrivateInterface::minFastReverseRate): added
700         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: member to cache ff/rw enabled state
701         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
702         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): observe on item canPlayFastForward canPlayFastReverse
703         (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayFastForwardDidChange): added
704         (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayFastReverseDidChange): added
705         (WebCore::itemKVOProperties): observe canPlayFastForward canPlayFastRewind
706         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): ditto
707         * platform/ios/WebVideoFullscreenInterface.h: add new method
708         * platform/ios/WebVideoFullscreenInterfaceAVKit.h: ditto
709         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: ditto
710         (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): Set value on WebAVPlayerController.
711         (-[WebAVPlayerController canScanBackward]): Deleted.
712         (+[WebAVPlayerController keyPathsForValuesAffectingCanScanBackward]): Deleted.
713         * platform/ios/WebVideoFullscreenModelMediaElement.mm:
714         (WebVideoFullscreenModelMediaElement::updateForEventName): update canPlayFastReverse.
715
716 2014-07-18  Gavin Barraclough  <baraclough@apple.com>
717
718         HTMLMediaElement should registerWithDocument on iOS
719         https://bugs.webkit.org/show_bug.cgi?id=135084
720         <rdar://problem/17702531>
721
722         Reviewed by Andreas Kling.
723
724         Otherwise it won't know when the visibility changes!
725
726         * html/HTMLMediaElement.cpp:
727         (WebCore::HTMLMediaElement::registerWithDocument):
728         (WebCore::HTMLMediaElement::unregisterWithDocument):
729
730 2014-07-20  Jeremy Jones  <jeremyj@apple.com>
731
732         Decrease flicker when enter and exit fullscreen.
733         https://bugs.webkit.org/show_bug.cgi?id=134919
734
735         Reviewed by Simon Fraser.
736
737         Put AVPlayerLayer in a container layer so moving it between inline and fullscreen
738         is as easy as adding and removing it from a containter layer; no need to do a layout.
739
740         Make sure fullscreen layers are transparent before moving moving the AVPlayerLayer
741         between inline and fullscreen so you don't briefly see the empty fullscreen layers.
742
743         * html/HTMLMediaElement.cpp:
744         (WebCore::HTMLMediaElement::platformLayer): remove fullscreen special case.
745         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): no need to recalc style
746         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: add inline container layer
747         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 
748         add WebVideoContainerLayer to contain AVPlayerLayer and keep layout correct.
749         (-[WebVideoContainerLayer setBounds:]): forward setbounds to set child frame.
750         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): create the video container layer
751         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): destroy the video container layer
752         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer): use container layer instead of video layer
753         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): use transactions to prevent unwanted animation.
754         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): ditto
755         * platform/graphics/ca/mac/PlatformCALayerMac.mm:
756         (PlatformCALayerMac::layerTypeForPlatformLayer): WebVideoContainerLayer is a kind of AVPlayerLayer
757         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
758         (-[WebVideoFullscreenController didCleanupFullscreen]): remove video fullscreen layer first
759         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
760         (WebVideoFullscreenInterfaceAVKit::setupFullscreen): make background transparent during transition.
761            dispatch_async to allow CATransaction to complete before calling didSetupFullscreen()
762
763 2014-07-20  Ryuan Choi  <ryuan.choi@samsung.com>
764
765         Move ExceptionCodeDescription.h into the files that actually need it
766         https://bugs.webkit.org/show_bug.cgi?id=134968
767
768         Reviewed by Darin Adler.
769
770         No new tests because no functional changes.
771
772         * Modules/indexeddb/IDBDatabaseException.cpp:
773         * Modules/webdatabase/SQLException.cpp:
774         * bindings/js/JSDOMBinding.cpp:
775         * bindings/objc/ExceptionHandlers.mm:
776         * bindings/scripts/CodeGeneratorGObject.pm:
777         (Generate):
778         * dom/DOMCoreException.cpp:
779         * dom/EventException.cpp:
780         * dom/ExceptionBase.cpp:
781         * dom/ExceptionCode.h:
782         * dom/RangeException.cpp:
783         * fileapi/FileException.cpp:
784         * inspector/DOMEditor.cpp:
785         * inspector/InspectorDOMAgent.cpp:
786         * svg/SVGException.cpp:
787         * xml/XMLHttpRequestException.cpp:
788         * xml/XPathException.cpp:
789
790 2014-07-20  Dan Bernstein  <mitz@apple.com>
791
792         <rdar://problems/17742611> -[_WKActivatedElementInfo image] is often empty
793         https://bugs.webkit.org/show_bug.cgi?id=135107
794
795         Reviewed by Sam Weinig.
796
797         Test: TestWebKitAPI/Tests/mac/RenderedImageFromDOMNode.mm
798
799         * page/FrameView.cpp:
800         (WebCore::FrameView::paintContents): To work around http://webkit.org/b/135106, replace the
801         paint root with its nearest ancestor that isn’t an inline with culled line boxes, if needed.
802
803 2014-07-20  Darin Adler  <darin@apple.com>
804
805         Crashes seen in wheel event handling
806         https://bugs.webkit.org/show_bug.cgi?id=135102
807
808         Reviewed by Beth Dakin.
809
810         Speculative fix based on guesses about what could be crashing.
811         The crash seems to be calling ref on an event target, and my guess is that this
812         has something to do with latching.
813
814         * page/EventHandler.cpp:
815         (WebCore::EventHandler::platformPrepareForWheelEvents): Updated argument types.
816         (WebCore::EventHandler::handleWheelEvent): Refactored a little and made some local
817         variables use RefPtr instead of raw pointers. Also added some comments.
818
819         * page/EventHandler.h: Changed argument types to RefPtr.
820
821         * page/mac/EventHandlerMac.mm:
822         (WebCore::EventHandler::platformPrepareForWheelEvents): Updated argument types.
823         Also added a FIXME.
824
825 2014-07-20  Simon Fraser  <simon.fraser@apple.com>
826
827         Print layerIDs in GraphicsLayer dumps
828         https://bugs.webkit.org/show_bug.cgi?id=135100
829
830         Reviewed by Darin Adler.
831
832         When calling showGraphicsLayerTree() from the debugger, it's useful to show
833         layerIDs so they can be correlated with remote layer tree transactions. So
834         when dumping with debug info, dump the primary layer ID.
835
836         * platform/graphics/GraphicsLayer.cpp:
837         (WebCore::GraphicsLayer::dumpProperties):
838
839 2014-07-20  Eric Carlson  <eric.carlson@apple.com>
840
841         [iOS] ignore requests to set volume
842         https://bugs.webkit.org/show_bug.cgi?id=135081
843
844         Applied post-review comments from Darin Adler.
845
846         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
847         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): Don't include unreachable
848             code on iOS.
849
850 2014-07-19  Mark Rowe  <mrowe@apple.com>
851
852         <https://webkit.org/b/135085> Ensure that make_names.pl generates the same result when run multiple times.
853
854         Perl 5.18 introduced hash randomization. This results in the iteration order of hashes being different
855         from one run to the next. To ensure identical output we can iterate over the hash keys in sorted order.
856
857         Reviewed by Alexey Proskuryakov.
858
859         * bindings/scripts/StaticString.pm:
860         (GenerateStrings):
861         (GenerateStringAsserts):
862         * dom/make_names.pl:
863
864 2014-07-19  Zan Dobersek  <zdobersek@igalia.com>
865
866         Document::unregisterNodeListforInvalidation() and Document::unregisterCollection() have incorrect assertions
867         https://bugs.webkit.org/show_bug.cgi?id=134869
868
869         Reviewed by Darin Adler.
870
871         Both methods should assert that the relevant HashMap is either empty if invalidation originates
872         from Document::invalidateNodeListAndCollectionCaches() or acutally contains the element that is
873         being invalidated. In the first case the HashMap is empty because its entries were moved out in
874         the Document::invalidateNodeListAndCollectionCaches().
875
876         This was exposed by r170995 (later rolled out in r170999) which introduced move constructor and
877         move assignment operators for HashTable. The assertions in the titular methods won't be passing
878         until r170995 relands.
879
880         * dom/Document.cpp:
881         (WebCore::Document::unregisterNodeListForInvalidation):
882
883 2014-07-18  Eric Carlson  <eric.carlson@apple.com>
884
885         [iOS] ignore requests to set volume
886         https://bugs.webkit.org/show_bug.cgi?id=135081
887
888         Reviewed by Jer Noble.
889
890         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
891         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): Do nothing on iOS.
892
893 2014-07-18  Andy Estes  <aestes@apple.com>
894
895         [iOS] Tapping "Allow Website" on a restricted page does not bring up the keypad
896         https://bugs.webkit.org/show_bug.cgi?id=135072
897         <rdar://problem/17528188>
898
899         Reviewed by David Kilzer.
900
901         No new tests. Content filtering is not testable from WebKit.
902
903         * WebCore.exp.in: Exported necessary ContentFilter symbols.
904         * loader/DocumentLoader.cpp:
905         (WebCore::DocumentLoader::finishedLoading): Called FrameLoaderClient::contentFilterDidBlockLoad().
906         (WebCore::DocumentLoader::responseReceived): Created a new ContentFilter.
907         (WebCore::DocumentLoader::dataReceived): Called FrameLoaderClient::contentFilterDidBlockLoad().
908         (WebCore::DocumentLoader::setContentFilterForBlockedLoad): Deleted.
909         (WebCore::DocumentLoader::handleContentFilterRequest): Deleted.
910         * loader/DocumentLoader.h:
911         * loader/FrameLoaderClient.h:
912         (WebCore::FrameLoaderClient::contentFilterDidBlockLoad):
913         * loader/PolicyChecker.cpp:
914         (WebCore::PolicyChecker::checkNavigationPolicy): Removed the check for unblock navigations, as this is now
915         handled at the WebKit layer.
916         * platform/ContentFilter.h: ContentFilter no longer needs to be RefCounted, so made various changes in order to
917         make it compatible with unique_ptr.
918         * platform/ios/ContentFilterIOS.mm:
919         (WebCore::scheme): Changed from a public member function to a static inline free function.
920         (WebCore::ContentFilter::handleUnblockRequestAndDispatchIfSuccessful): Renamed from requestUnblockAndDispatchIfSuccessful.
921         * platform/mac/ContentFilterMac.mm:
922         (WebCore::ContentFilter::ContentFilter): Added a default constructor for use during message decoding.
923         (WebCore::ContentFilter::addData): Removed calls to ref() and deref(). These were never actually needed since
924         we were dispatching the block synchronously.
925         (WebCore::ContentFilter::finishedAddingData): Ditto.
926         (WebCore::ContentFilter::encode): Encoded m_platformContentFilter to the NSKeyedArchiver if it conforms to NSSecureCoding.
927         (WebCore::ContentFilter::decode): Decoded m_platformContentFilter from the NSKeyedUnarchiver if it conforms to NSSecureCoding.
928         (WebCore::ContentFilter::create): Deleted.
929
930 2014-07-18  Simon Fraser  <simon.fraser@apple.com>
931
932         [iOS WK2] position:fixed in iframes with programmatic scroll could end up in the wrong place
933         https://bugs.webkit.org/show_bug.cgi?id=135078
934         <rdar://problem/17401823>
935
936         Reviewed by Tim Horton.
937         
938         When the UI-side scrolling tree receives a requested scroll position update, it scrolls
939         the node (e.g. a frame) then traverses child nodes to update them, e.g. for fixed position.
940         However, we would always use a viewport rect for the main document (from the scrolling tree),
941         which is not appropriate for subframes. Subframes should just use their own visible
942         rect to position fixed children.
943
944         Test: platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html
945
946         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
947         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateChildNodesAfterScroll):
948
949 2014-07-18  Beth Dakin  <bdakin@apple.com>
950
951         Fixed position elements are misplaced when a WK1 view has contentInsets set
952         https://bugs.webkit.org/show_bug.cgi?id=135031
953         -and corresponding-
954         <rdar://problem/17682335>
955
956         Reviewed by Tim Horton.
957
958         [NSScrollView documentVisibleRect] includes content that is within the inset-area 
959         of a view, but WebCore is interested in the content that is fully visible, so we 
960         need to factor the inset sizes out of this rect.
961
962         Implement contract() to avoid the awkwardness of calling expand() with negative 
963         values.
964         * platform/graphics/IntSize.h:
965         (WebCore::IntSize::contract):
966
967         Factor out insets
968         * platform/mac/ScrollViewMac.mm:
969         (WebCore::ScrollView::platformVisibleContentRect):
970         (WebCore::ScrollView::platformVisibleContentSize):
971
972 2014-07-18  Tim Horton  <timothy_horton@apple.com>
973
974         Take navigation snapshots whenever the current back-forward item is going to change
975         https://bugs.webkit.org/show_bug.cgi?id=135058
976         <rdar://problem/17464515>
977
978         Reviewed by Dan Bernstein.
979
980         * loader/HistoryController.cpp:
981         (WebCore::HistoryController::updateForCommit):
982         (WebCore::HistoryController::recursiveUpdateForCommit):
983         (WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation):
984         (WebCore::HistoryController::createItem):
985         Use setCurrentItem instead of duplicating the contents of it inside each of these functions.
986
987         (WebCore::HistoryController::setCurrentItem):
988         (WebCore::HistoryController::replaceCurrentItem):
989         When setting or replacing the current item, let the FrameLoaderClient know that we're going
990         to change which history item is "current".
991
992         * loader/FrameLoaderClient.h:
993         (WebCore::FrameLoaderClient::willChangeCurrentHistoryItem): Added.
994
995 2014-07-18  Commit Queue  <commit-queue@webkit.org>
996
997         Unreviewed, rolling out r171207.
998         https://bugs.webkit.org/show_bug.cgi?id=135056
999
1000         Broke multiple tests on Yosemite (Requested by ap on #webkit).
1001
1002         Reverted changeset:
1003
1004         "Fixed position elements are misplaced when a WK1 view has
1005         contentInsets set"
1006         https://bugs.webkit.org/show_bug.cgi?id=135031
1007         http://trac.webkit.org/changeset/171207
1008
1009 2014-07-18  Commit Queue  <commit-queue@webkit.org>
1010
1011         Unreviewed, rolling out r171218.
1012         https://bugs.webkit.org/show_bug.cgi?id=135055
1013
1014         Made fast/dom/HTMLObjectElement/beforeload-set-text-
1015         crash.xhtml crash (Requested by ap on #webkit).
1016
1017         Reverted changeset:
1018
1019         "REGRESSION (r169105): Crash in selection"
1020         https://bugs.webkit.org/show_bug.cgi?id=134303
1021         http://trac.webkit.org/changeset/171218
1022
1023 2014-07-18  Radu Stavila  <stavila@adobe.com>
1024
1025         REGRESSION (r169105): Crash in selection
1026         https://bugs.webkit.org/show_bug.cgi?id=134303
1027
1028         Reviewed by Ryosuke Niwa.
1029
1030         When splitting the selection between different subtrees, all subtrees must have their selection cleared before
1031         starting to apply the new selection. Otherwise, when selecting objects in a named flow thread and going up
1032         its containing block chain, we can end up in the view's selection root, which has not yet been updated and so
1033         we get inconsistent data.
1034
1035         To achieve this goal, the selection update was split into a "clear" and an "apply" method. The updateSelectionForSubtrees
1036         method first iterates through all subtrees and performs the "clear" method and then starts all over again
1037         and performs the "apply" method.
1038
1039         Also, the selectionStart/End members in RenderView have been renamed to fix problems caused by the fact that
1040         RenderView inherits SelectionSubtreeRoot, which also has the same selectionStart/End members.
1041
1042         Test: fast/regions/selection/crash-deselect.html
1043
1044         * WebCore.xcodeproj/project.pbxproj:
1045         * rendering/RenderBlock.cpp:
1046         (WebCore::RenderBlock::isSelectionRoot):
1047         * rendering/RenderSelectionInfo.h:
1048         * rendering/RenderView.cpp:
1049         (WebCore::RenderView::RenderView):
1050         (WebCore::RenderView::setSelection): Renamed m_selectionStart/End to m_unsplitSelectionStart/End
1051         (WebCore::RenderView::splitSelectionBetweenSubtrees):
1052         (WebCore::RenderView::updateSelectionForSubtrees): Added, clears and re-applies selection for all selection subtrees.
1053         (WebCore::RenderView::clearSubtreeSelection): Added, clears selection and returns previously selected information.
1054         (WebCore::RenderView::applySubtreeSelection): Added, updates the selection status of all objects inside the selection tree, compares old and new data and repaints accordingly.
1055         (WebCore::RenderView::getSelection): Renamed m_selectionStart/End to m_unsplitSelectionStart/End
1056         (WebCore::RenderView::setSubtreeSelection): Deleted.
1057         * rendering/RenderView.h:
1058         * rendering/SelectionSubtreeRoot.cpp:
1059         (WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot):
1060         * rendering/SelectionSubtreeRoot.h:
1061         (WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData):
1062
1063 2014-07-17  Jer Noble  <jer.noble@apple.com>
1064
1065         [MSE] Re-enqueue after a removeCodedFrames() only if the removed frames overlap what may have possibly been enqueued but undisplayed.
1066         https://bugs.webkit.org/show_bug.cgi?id=135039
1067
1068         Reviewed by Eric Carlson.
1069
1070         When a client calls removeCodedFrames(), we must re-enqueue those ranges if the removed samples overlap with
1071         enqueued but possibly un-displayed samples. Otherwise, replacement samples may lead to decode errors as those
1072         new samples dependencies are not met. But if we re-enqueue too frequently, this may cause subtle but noticible
1073         display timing glitches, so only re-enqueue when removeCodedFrames have a possiblity of removing enqueued, but
1074         not yet displayed samples.
1075
1076         * Modules/mediasource/SourceBuffer.cpp:
1077         (WebCore::SourceBuffer::removeCodedFrames):
1078
1079 2014-07-17  David Kilzer  <ddkilzer@apple.com>
1080
1081         SECTORDER_FLAGS should be defined in target's xcconfig file, not Base.xcconfig
1082         <http://webkit.org/b/135006>
1083
1084         Reviewed by Darin Adler.
1085
1086         * Configurations/Base.xcconfig: Move SECTORDER_FLAGS to
1087         WebCore.xcconfig.
1088         * Configurations/DebugRelease.xcconfig: Remove empty
1089         SECTORDER_FLAGS definition.
1090         * Configurations/WebCoreTestShim.xcconfig: Ditto.
1091         * Configurations/WebCoreTestSupport.xcconfig: Ditto.
1092         * Configurations/WebCore.xcconfig: Use $(CONFIGURATION) so
1093         SECTORDER_FLAGS is only set on Production builds.
1094
1095 2014-07-17  Zalan Bujtas  <zalan@apple.com>
1096
1097         Subpixel rendering: Embedded non-compositing rotate transform paints to wrong position.
1098         https://bugs.webkit.org/show_bug.cgi?id=135028
1099
1100         Reviewed by Simon Fraser.
1101
1102         CTM always translates to where the layer's renderer() is going to paint.
1103         It ensures that the pixel snapped renderer() always end up painting to (0, 0) which is
1104         required to be able to position properly on transformed context.
1105
1106         Test: fast/layers/hidpi-transform-on-child-content-is-mispositioned.html
1107
1108         * rendering/RenderLayer.cpp:
1109         (WebCore::RenderLayer::beginTransparencyLayers):
1110         (WebCore::RenderLayer::clipToRect):
1111         (WebCore::RenderLayer::paintLayerByApplyingTransform):
1112         (WebCore::RenderLayer::paintBackgroundForFragments):
1113         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
1114         (WebCore::RenderLayer::paintOutlineForFragments):
1115         (WebCore::RenderLayer::paintMaskForFragments):
1116         (WebCore::RenderLayer::paintOverflowControlsForFragments):
1117         (WebCore::RenderLayer::calculateClipRects):
1118         * rendering/RenderLayer.h:
1119
1120 2014-07-17  Beth Dakin  <bdakin@apple.com>
1121
1122         Fixed position elements are misplaced when a WK1 view has contentInsets set
1123         https://bugs.webkit.org/show_bug.cgi?id=135031
1124         -and corresponding-
1125         <rdar://problem/17682335>
1126
1127         Reviewed by Tim Horton.
1128
1129         [NSScrollView documentVisibleRect] is not the rect that we are looking for when 
1130         this function is called. WebCore is interested in the rect that does not include 
1131         content that is within the inset region.
1132
1133         Implement contract() to avoid the awkwardness of calling expand() with negative 
1134         values.
1135         * platform/graphics/IntSize.h:
1136         (WebCore::IntSize::contract):
1137
1138         Use _insetBounds instead of documentVisibleRect, and when it’s necessary to use 
1139         the frame’s dimensions, extract the inset from that size.
1140         * platform/mac/ScrollViewMac.mm:
1141         (WebCore::ScrollView::platformVisibleContentRect):
1142         (WebCore::ScrollView::platformVisibleContentSize):
1143
1144 2014-07-17  Enrica Casucci  <enrica@apple.com>
1145
1146         [REGRESSION WK2]The menu bar does not show up when tapping on the caret.
1147         https://bugs.webkit.org/show_bug.cgi?id=135023
1148         <rdar://problem/17617282>
1149
1150         Reviewed by Benjamin Poulain.
1151
1152         Adding some exports.
1153         
1154         * WebCore.exp.in:
1155
1156 2014-07-17  Timothy Hatcher  <timothy@apple.com>
1157
1158         Make console.profile record to the Timeline.
1159
1160         https://bugs.webkit.org/show_bug.cgi?id=134643
1161
1162         Reviewed by Joseph Pecoraro.
1163
1164         Passes existing profiler tests in fast/profiler.
1165
1166         * bindings/js/ScriptState.cpp:
1167         (WebCore::domWindowFromExecState):
1168         (WebCore::frameFromExecState):
1169         (WebCore::scriptExecutionContextFromExecState):
1170         (WebCore::mainWorldExecState):
1171         (WebCore::execStateFromNode):
1172         * bindings/js/ScriptState.h:
1173         * inspector/InspectorController.cpp:
1174         (WebCore::InspectorController::InspectorController):
1175         (WebCore::InspectorController::profilerEnabled):
1176         (WebCore::InspectorController::setProfilerEnabled):
1177         * inspector/InspectorController.h:
1178         * inspector/InspectorInstrumentation.cpp:
1179         (WebCore::InspectorInstrumentation::startProfilingImpl):
1180         (WebCore::InspectorInstrumentation::stopProfilingImpl):
1181         * inspector/InspectorTimelineAgent.cpp:
1182         (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
1183         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
1184         (WebCore::InspectorTimelineAgent::start):
1185         (WebCore::InspectorTimelineAgent::stop):
1186         (WebCore::startProfiling):
1187         (WebCore::stopProfiling):
1188         (WebCore::InspectorTimelineAgent::startFromConsole):
1189         (WebCore::InspectorTimelineAgent::stopFromConsole):
1190         (WebCore::InspectorTimelineAgent::didWriteHTML):
1191         (WebCore::InspectorTimelineAgent::breakpointActionProbe):
1192         (WebCore::toProtocol):
1193         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
1194         (WebCore::InspectorTimelineAgent::didCompleteRecordEntry):
1195         (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
1196         (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
1197         (WebCore::InspectorTimelineAgent::sendEvent):
1198         (WebCore::InspectorTimelineAgent::createRecordEntry):
1199         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
1200         * inspector/InspectorTimelineAgent.h:
1201         (WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry):
1202         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
1203         * inspector/InstrumentingAgents.cpp:
1204         (WebCore::InstrumentingAgents::InstrumentingAgents):
1205         (WebCore::InstrumentingAgents::reset):
1206         * inspector/InstrumentingAgents.h:
1207         (WebCore::InstrumentingAgents::persistentInspectorTimelineAgent):
1208         (WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent):
1209         * inspector/TimelineRecordFactory.cpp:
1210         (WebCore::TimelineRecordFactory::createConsoleProfileData):
1211         * inspector/TimelineRecordFactory.h:
1212         * inspector/protocol/Timeline.json:
1213         * page/PageConsole.cpp:
1214         (WebCore::PageConsole::profileEnd):
1215
1216 2014-07-16  Sam Weinig  <sam@webkit.org>
1217
1218         Don't send geolocation permission requests when the page is not visible
1219         <rdar://problem/17208715>
1220         https://bugs.webkit.org/show_bug.cgi?id=134989
1221
1222         Reviewed by Darin Adler.
1223
1224         Instead of eagerly requesting geolocation permission for pages that aren't visible,
1225         store a set of pending requests, and send them only once the page has become visible.
1226
1227         * Modules/geolocation/GeolocationController.cpp:
1228         (WebCore::GeolocationController::GeolocationController):
1229         (WebCore::GeolocationController::~GeolocationController):
1230         (WebCore::GeolocationController::requestPermission):
1231         (WebCore::GeolocationController::cancelPermissionRequest):
1232         (WebCore::GeolocationController::viewStateDidChange):
1233         (WebCore::provideGeolocationTo):
1234         * Modules/geolocation/GeolocationController.h:
1235         Store pending requests to be fired once the page is visible.
1236
1237         * WebCore.xcodeproj/project.pbxproj:
1238         Add ViewStateChangeObserver.h
1239
1240         * page/Page.cpp:
1241         (WebCore::Page::addViewStateChangeObserver):
1242         (WebCore::Page::removeViewStateChangeObserver):
1243         (WebCore::Page::setViewState):
1244         * page/Page.h:
1245         Add a set of registered view state observers, and notify them when the
1246         view state changes.
1247
1248         * page/ViewStateChangeObserver.h: Added.
1249         (WebCore::ViewStateChangeObserver::~ViewStateChangeObserver):
1250         Add an observer that can register with the page for view state changes.
1251
1252 2014-07-17  Jer Noble  <jer.noble@apple.com>
1253
1254         Enable legacy fullscreen API in media controls
1255         https://bugs.webkit.org/show_bug.cgi?id=134985
1256
1257         Reviewed by Eric Carlson.
1258
1259         Allow clients who have not enabled HTML5 Fullscreen APIs to still use fullscreen mode
1260         with <video> elements by using the legacy, video-element-specific fullscreen APIs in
1261         the <video> media controls.
1262
1263         * Modules/mediacontrols/mediaControlsApple.js:
1264         (Controller):
1265         (Controller.prototype.handleReadyStateChange):
1266         (Controller.prototype.isFullScreen):
1267         (Controller.prototype.handlePlayButtonClicked):
1268         (Controller.prototype.updateFullscreenButton):
1269         (Controller.prototype.handleFullscreenButtonClicked):
1270
1271 2014-07-17  Vineet Chaudhary  <code.vineet@gmail.com>
1272
1273         [GObject] StrictTypeChecking extended attribute fails for methods with sequence<T>.
1274         https://bugs.webkit.org/show_bug.cgi?id=121698
1275
1276         Reviewed by Antonio Gomes.
1277
1278         GodeGenerator was including wrong heeaders as WebKitDOMlong[] for methods with
1279         array parameters and StrictTypeChecking extended attribute.
1280         No new tests. TestObj.idl covers the tests.
1281
1282         * bindings/scripts/CodeGenerator.pm:
1283         (GetArrayOrSequenceType):
1284         * bindings/scripts/CodeGeneratorGObject.pm:
1285         (GenerateFunction):
1286         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
1287         (webkit_dom_test_obj_strict_function_with_array):
1288         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
1289         * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp:
1290         (webkit_dom_test_typedefs_func):
1291         (webkit_dom_test_typedefs_nullable_array_arg):
1292         * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h:
1293         * bindings/scripts/test/TestObj.idl:
1294
1295 2014-07-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1296
1297         CSS JIT: Clean up return path
1298         https://bugs.webkit.org/show_bug.cgi?id=135011
1299
1300         Reviewed by Benjamin Poulain.
1301
1302         Clean up the existing CSS JIT return path before adding new early return path
1303         for pseudo elements.
1304
1305         * cssjit/SelectorCompiler.cpp:
1306         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
1307         * cssjit/StackAllocator.h:
1308         (WebCore::StackAllocator::StackReference::StackReference):
1309         (WebCore::StackAllocator::StackReference::isValid):
1310         (WebCore::StackAllocator::popAndDiscard): Deleted.
1311
1312 2014-07-16  Zalan Bujtas  <zalan@apple.com>
1313
1314         Subpixel rendering: Adjust cliprect with devicePixelFractionFromRenderer() before painting.
1315         https://bugs.webkit.org/show_bug.cgi?id=134950
1316         <rdar://problem/17617994>
1317
1318         Reviewed by Simon Fraser.
1319
1320         The cliprect coming from the graphics layer needs to be adjusted with the subpixel gap
1321         from renderer. This is symmetric with the offsetting we do, when the dirty rect is sent off to the GraphicsLayer.
1322         It puts us back to the correct coordinating system for intersecting with renderers.
1323
1324         Test: compositing/hidpi-compositing-layer-with-tile-layers-on-subpixel-position.html
1325
1326         * rendering/RenderLayer.cpp:
1327         (WebCore::RenderLayer::beginTransparencyLayers):
1328         (WebCore::RenderLayer::clipToRect):
1329
1330 2014-07-16  Simon Fraser  <simon.fraser@apple.com>
1331
1332         Fix a typo noticed by Darin.
1333         
1334         * rendering/RenderBox.cpp:
1335         (WebCore::shouldApplyContainersClipAndOffset):
1336         (WebCore::RenderBox::computeRectForRepaint):
1337         (WebCore::shouldAppyContainersClipAndOffset): Deleted.
1338
1339 2014-07-16  Simon Fraser  <simon.fraser@apple.com>
1340
1341         Improve showTree() logging
1342         https://bugs.webkit.org/show_bug.cgi?id=134997
1343
1344         Reviewed by Tim Horton.
1345
1346         Have the debug showTree(), which dumps the Node/Element tree, show which nodes need
1347         style recalc, and print element renderers.
1348
1349         * dom/Node.cpp:
1350         (WebCore::Node::showNode):
1351
1352 2014-07-16  Simon Fraser  <simon.fraser@apple.com>
1353
1354         [iOS] Expose the points on WebEventRegion
1355         https://bugs.webkit.org/show_bug.cgi?id=134978
1356
1357         Reviewed by Tim Horton.
1358
1359         Expose WebEventRegion's points so that UIKit can get at them.
1360
1361         * page/ios/WebEventRegion.h:
1362         * page/ios/WebEventRegion.mm:
1363         (-[WebEventRegion p1]):
1364         (-[WebEventRegion p2]):
1365         (-[WebEventRegion p3]):
1366         (-[WebEventRegion p4]):
1367
1368 2014-07-16  Brady Eidson  <beidson@apple.com>
1369
1370         Add WebSecurityOrigin "webSecurityOriginFromDatabaseIdentifier" SPI and change _websiteDataURLForContainerWithURL: SPI
1371         <rdar://problem/17454712> and https://bugs.webkit.org/show_bug.cgi?id=134984
1372
1373         Reviewed by Dan Bernstein.
1374
1375         Change _websiteDataURLForContainerWithURL: SPI to include an optional bundle identifier argument:
1376         * UIProcess/API/Cocoa/WKProcessPool.mm:
1377         (+[WKProcessPool _websiteDataURLForContainerWithURL:bundleIdentifierIfNotInContainer:]):
1378         (+[WKProcessPool _websiteDataURLForContainerWithURL:]): Deleted.
1379         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1380
1381         Add a big shiny comment in a few key places:
1382         * DatabaseProcess/DatabaseProcess.cpp:
1383         (WebKit::DatabaseProcess::initializeDatabaseProcess):
1384         * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
1385         (WebKit::UniqueIDBDatabase::UniqueIDBDatabase):
1386         * UIProcess/WebContext.cpp:
1387         (WebKit::WebContext::applyPlatformSpecificConfigurationDefaults):
1388         (WebKit::WebContext::ensureDatabaseProcess):
1389
1390 2014-07-16  Roger Fong  <roger_fong@apple.com>
1391
1392         Captions container should not clip content.
1393         https://bugs.webkit.org/show_bug.cgi?id=134840.
1394         <rdar://problem/14553608>.
1395
1396         Reviewed by Simon Fraser.
1397
1398         Tests: media/track/track-in-band-subtitles-too-large.html
1399                media/track/track-long-word-container-sizing.html
1400
1401         * Modules/mediacontrols/mediaControlsApple.css:
1402         (video::-webkit-media-text-track-container):
1403         Set word break property of WebCTT cues to normal to make it consistent with in-band cues.
1404         * html/track/TextTrackCueGeneric.cpp:
1405         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1406         Set -webkit-min-content on min-width/min-height property of the text track display.
1407         * html/track/VTTCue.cpp:
1408         (WebCore::VTTCueBox::applyCSSProperties):
1409         Do the same for WebVTT cues.
1410
1411 2014-07-16  Eric Carlson  <eric.carlson@apple.com>
1412
1413         [Mac] replace AVPlayerItem on the main thread
1414         https://bugs.webkit.org/show_bug.cgi?id=134983
1415
1416         Reviewed by Jer Noble.
1417
1418         No new tests, this fixes a problem with a thread configuration not present in the
1419         test environment.
1420
1421         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1422         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1423         (WebCore::MediaPlayerPrivateAVFoundationObjC::setAVPlayerItem): New, when called off of 
1424             the main thread, dispatch to the main thread before setting AVPlayerItem.
1425         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Call setAVPlayerItem.
1426         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Ditto.
1427         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData): Ditto.
1428
1429 2014-07-16  Jer Noble  <jer.noble@apple.com>
1430
1431         [MSE] http/tests/media/media-source/mediasource-buffered.html is flakey
1432         https://bugs.webkit.org/show_bug.cgi?id=134949
1433
1434         Reviewed by Eric Carlson.
1435
1436         Depending on which SourceBuffer is successfully parsed first, the order of activeSourceBuffers
1437         may change from run to run, breaking the http/tests/media/media-source/mediasource-buffered.html
1438         test. Make the order of activeSourceBuffers the same as (a subset of) sourceBuffers, by replacing
1439         calls to activeSourceBuffers->add() and with a new call to regenerateActiveSourceBuffers(), which
1440         swaps the contents of the SourceBufferList with a new, ordered Vector.
1441
1442         * Modules/mediasource/MediaSource.cpp:
1443         (WebCore::MediaSource::addSourceBuffer):
1444         (WebCore::MediaSource::sourceBufferDidChangeAcitveState):
1445         (WebCore::MediaSource::regenerateActiveSourceBuffers):
1446         * Modules/mediasource/MediaSource.h:
1447         * Modules/mediasource/SourceBufferList.cpp:
1448         (WebCore::SourceBufferList::swap):
1449         * Modules/mediasource/SourceBufferList.h:
1450
1451 2014-07-16  Mike West  <mkwst@chromium.org>
1452
1453         CSP: Drop 'script-nonce' directive.
1454         https://bugs.webkit.org/show_bug.cgi?id=134926
1455
1456         Reviewed by Darin Adler.
1457
1458         This patch drops the outdated 'script-nonce' Content Security
1459         Policy directive. It was removed from the spec, and replaced in
1460         CSP2 with a new 'script-src' syntax. We should implement that
1461         instead.
1462
1463         Until then, removing the outdated syntax will ensure that no one
1464         ends up relying on it in WebKit's implementation.
1465
1466         This should have limited web-visible impact, as the feature is
1467         behind the CSP_NEXT flag, which is not enabled by default.
1468
1469         * dom/ScriptElement.cpp:
1470         (WebCore::ScriptElement::requestScript):
1471         (WebCore::ScriptElement::executeScript):
1472         * page/ContentSecurityPolicy.cpp:
1473         (WebCore::CSPDirectiveList::allowJavaScriptURLs):
1474         (WebCore::CSPDirectiveList::allowInlineEventHandlers):
1475         (WebCore::CSPDirectiveList::addDirective):
1476         (WebCore::NonceDirective::NonceDirective): Deleted.
1477         (WebCore::NonceDirective::allows): Deleted.
1478         (WebCore::NonceDirective::parse): Deleted.
1479         (WebCore::CSPDirectiveList::checkNonce): Deleted.
1480         (WebCore::CSPDirectiveList::checkNonceAndReportViolation): Deleted.
1481         (WebCore::CSPDirectiveList::allowScriptNonce): Deleted.
1482         (WebCore::isAllowedByAllWithNonce): Deleted.
1483         (WebCore::ContentSecurityPolicy::allowScriptNonce): Deleted.
1484         (WebCore::ContentSecurityPolicy::reportInvalidNonce): Deleted.
1485         * page/ContentSecurityPolicy.h:
1486
1487 2014-07-16  Jer Noble  <jer.noble@apple.com>
1488
1489         REGRESSION(r171069) 75% repro crash in WebCore::AudioHardwareListenerMac::processIsRunningChanged()
1490         https://bugs.webkit.org/show_bug.cgi?id=134986
1491
1492         Reviewed by Eric Carlson.
1493
1494         Add a WeakPtrFactory to AudioHardwareListenerMac, so that if CoreAudio calls our block after
1495         being unregistered, we can bail early instead of calling into a deleted object.
1496
1497         * platform/audio/mac/AudioHardwareListenerMac.cpp:
1498         (WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac):
1499         * platform/audio/mac/AudioHardwareListenerMac.h:
1500
1501 2014-07-16  Jer Noble  <jer.noble@apple.com>
1502
1503         [MSE] REGRESSION(r171033): ASSERT in WebCore::MediaSource::onReadyStateChange()
1504         https://bugs.webkit.org/show_bug.cgi?id=134941
1505
1506         Reviewed by Eric Carlson.
1507
1508         Only do our modified-order change of the readyState if the error parameter is empty,
1509         as that's the only case where a duration change will cause an inadvertant readyState
1510         change.
1511
1512         * Modules/mediasource/MediaSource.cpp:
1513         (WebCore::MediaSource::streamEndedWithError):
1514
1515 2014-07-16  Alexey Proskuryakov  <ap@apple.com>
1516
1517         Remove svn:executable property erroneously added in <http://trac.webkit.org/changeset/171144> somehow.
1518
1519         * ChangeLog: Removed property svn:executable.
1520         * svg/SVGSVGElement.h: Removed property svn:executable.
1521         * svg/animation/SVGSMILElement.h: Removed property svn:executable.
1522
1523 2014-07-16  Daniel Bates  <dabates@apple.com>
1524
1525         Substitute CGRectZero for NSZeroRect in -[DOMNode hrefFrame].
1526
1527         Rubber-stamped by Zalan Bujtas.
1528
1529         The method -[DOMNode hrefFrame] returns a CGRect. So, when we don't have a renderer
1530         we should return CGRectZero instead of a NSZeroRect.
1531
1532         * bindings/objc/DOM.mm:
1533         (-[DOMNode hrefFrame]): Also, fix up some code style issues.
1534
1535 2014-07-16  Jeongeun Kim  <je_julie.kim@samsung.com>
1536
1537         mutable pointers from const methods, timeContainer().
1538         https://bugs.webkit.org/show_bug.cgi?id=134757
1539
1540         Reviewed by Alexey Proskuryakov.
1541
1542         Avoid return mutable pointers from const methods.
1543         No new tests, no behavior change.
1544
1545         * svg/SVGSVGElement.h:
1546         * svg/animation/SVGSMILElement.h:
1547         (WebCore::SVGSMILElement::timeContainer):
1548
1549 2014-07-15  Yusuke Suzuki  <utatane.tea@gmail.com>
1550
1551         CSS: Generalize CSS First Letter treatment
1552         https://bugs.webkit.org/show_bug.cgi?id=134936
1553
1554         Reviewed by Benjamin Poulain.
1555
1556         first-letter pseudo element rule is handled differently from the other rules
1557         such as first-line. This patch removes this special handling in SelectorChecker
1558         and handles it in RulesFeatureSet.
1559
1560         * css/RuleFeature.cpp:
1561         (WebCore::RuleFeatureSet::collectFeaturesFromSelector):
1562         (WebCore::RuleFeatureSet::add):
1563         (WebCore::RuleFeatureSet::clear):
1564         * css/RuleFeature.h:
1565         (WebCore::RuleFeatureSet::RuleFeatureSet):
1566         * css/SelectorChecker.cpp:
1567         (WebCore::SelectorChecker::matchRecursively):
1568         * css/StyleResolver.h:
1569         (WebCore::StyleResolver::usesFirstLetterRules):
1570         * dom/DocumentStyleSheetCollection.cpp:
1571         (WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
1572         (WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
1573         * dom/DocumentStyleSheetCollection.h:
1574         (WebCore::DocumentStyleSheetCollection::setUsesFirstLetterRules): Deleted.
1575
1576 2014-07-15  Simon Fraser  <simon.fraser@apple.com>
1577
1578         Fix non-iOS builds.
1579
1580         * rendering/RenderBox.cpp:
1581         (WebCore::shouldAppyContainersClipAndOffset):
1582
1583 2014-07-15  Simon Fraser  <simon.fraser@apple.com>
1584
1585         [iOS] Fix touches inside accelerated overflow:scroll
1586         https://bugs.webkit.org/show_bug.cgi?id=134961
1587         <rdar://problem/16088789>
1588
1589         Reviewed by Benjamin Poulain.
1590
1591         When individual elements inside an overflow:scroll with -webkit-overflow-scrolling: touch
1592         had touch event listeners, we would fail to take the scroll offset into account when
1593         building the touch event region, causing touches on those elements to fail after scrolling.
1594         
1595         Touch event region building uses RenderObject::absoluteClippedOverflowRect(), and that
1596         code path tries to fix up repaint rects to work correctly in composited overflow:scroll.
1597         However, that broke the touch region computation.
1598         
1599         Fix by only ignoring the scroll offset for calls to computeRectForRepaint() which
1600         have a non-null repaintContainer (which indicates that we're doing a repaint in the
1601         compositing layer), and for which the repaintContainer is the containing block
1602         which is using composited scrolling. This restores correct behavior to the event region
1603         code which always calls this with a null repaintContainer.
1604
1605         * rendering/RenderBox.cpp:
1606         (WebCore::shouldAppyContainersClipAndOffset):
1607         (WebCore::RenderBox::computeRectForRepaint):
1608
1609 2014-07-15  Simon Fraser  <simon.fraser@apple.com>
1610
1611         [iOS] Fix issues drawing subsampled image elements and CSS images
1612         https://bugs.webkit.org/show_bug.cgi?id=134944
1613         <rdar://problem/17634095>
1614
1615         Reviewed by Dean Jackson.
1616
1617         After r170675 it is important for BitmapImage::draw() to be given a srcRect computed
1618         using the original size of the image, not the subsampled size.
1619         
1620         So fix various code paths that end up in image drawing to use the originalSize(),
1621         which requires giving Image a virtual function that just returns size(), and hence has
1622         a FloatSize return value.
1623         
1624         Tested by setting a very low subsampling threshold and browsing various sites.
1625         
1626         A better longterm fix will happen via bug 134916.
1627
1628         * platform/graphics/BitmapImage.cpp:
1629         (WebCore::BitmapImage::originalSize):
1630         * platform/graphics/BitmapImage.h:
1631         * platform/graphics/GraphicsContext.cpp:
1632         (WebCore::GraphicsContext::drawImage):
1633         * platform/graphics/Image.cpp:
1634         (WebCore::Image::drawTiled):
1635         (WebCore::Image::computeIntrinsicDimensions):
1636         * platform/graphics/Image.h:
1637         (WebCore::Image::originalSize):
1638         * platform/graphics/cg/BitmapImageCG.cpp:
1639         (WebCore::BitmapImage::BitmapImage): Just use m_size for initializing the other members.
1640         (WebCore::BitmapImage::draw):
1641         * platform/graphics/cg/GraphicsContext3DCG.cpp:
1642         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
1643         * platform/graphics/cg/ImageCG.cpp:
1644         (WebCore::Image::drawPattern):
1645
1646 2014-07-15  Brent Fulgham  <bfulgham@apple.com>
1647
1648         [Win] Unreviewed build fix after r171069.
1649
1650         Add missing AudioHardwareListener implementation on Windows.
1651
1652         * WebCore.vcxproj/WebCore.vcxproj:
1653         * WebCore.vcxproj/WebCore.vcxproj.filters:
1654
1655 2014-07-15  Antti Koivisto  <antti@apple.com>
1656
1657         REGRESSION (r155957): Invalid cast in WebCore::RenderNamedFlowThread::getRanges
1658         https://bugs.webkit.org/show_bug.cgi?id=134888
1659
1660         Reviewed by Mihnea Ovidenie.
1661
1662         Test: fast/regions/flowthread-getranges-box-cast.html
1663
1664         * rendering/RenderNamedFlowThread.cpp:
1665         (WebCore::RenderNamedFlowThread::getRanges): Test the type before casting.
1666
1667 2014-07-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1668
1669         [GTK] Update GObject DOM bindings symbols file after r171014.
1670         https://bugs.webkit.org/show_bug.cgi?id=134907
1671
1672         Reviewed by Philippe Normand.
1673
1674         * bindings/gobject/webkitdom.symbols: Update to the current API.
1675
1676 2014-07-15  Manuel Rego Casasnovas  <rego@igalia.com>
1677
1678         Unreviwed fix wrong indentation from r171082.
1679
1680         * rendering/RenderGrid.cpp:
1681         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
1682
1683 2014-07-14  Zalan Bujtas  <zalan@apple.com>
1684
1685         Subpixel rendering: Zero sized compositing container's content positioned off by one device pixel.
1686         https://bugs.webkit.org/show_bug.cgi?id=134903
1687
1688         Reviewed by Simon Fraser.
1689
1690         The compositing layer boundaries are calculated using its renderer()'s and the renderer()'s
1691         descendants' bounds. However when the renderer() is zero sized, its bounds are omitted.
1692         In such cases, when the child content has offset from the renderer(), the subpixel adjustment
1693         of the compositing layer becomes negative (-meaning that the compositing layer is to the right/bottom
1694         direction from its renderer()). Remove fabs() to be able to express such direction.
1695
1696         Test: compositing/hidpi-compositing-layer-with-zero-sized-container.html
1697
1698         * rendering/RenderLayerBacking.cpp:
1699         (WebCore::RenderLayerBacking::updateGeometry):
1700
1701 2014-07-14  Jeremy Jones  <jeremyj@apple.com>
1702
1703         Fix crash on WebVideoFullscreenManagerProxy construction.
1704         https://bugs.webkit.org/show_bug.cgi?id=134909
1705
1706         Unreviewed fix crash from r171089
1707
1708         Remove unnecessary dispatch to main queue since it can happen during construction.
1709
1710         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1711         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel): remove dispatch_async
1712
1713 2014-07-14  Jeremy Jones  <jeremyj@apple.com>
1714
1715         WebVideoFullscreenInterfaceAVKit should only call the UI from main thread.
1716         https://bugs.webkit.org/show_bug.cgi?id=134890
1717
1718         Reviewed by Eric Carlson.
1719
1720         dispatch_async to the main thread before setting properties that would affect the UI.
1721
1722         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1723         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel): wrap in call to dispatch_async
1724         (WebVideoFullscreenInterfaceAVKit::setDuration): ditto
1725         (WebVideoFullscreenInterfaceAVKit::setCurrentTime): ditto
1726         (WebVideoFullscreenInterfaceAVKit::setRate): ditto
1727         (WebVideoFullscreenInterfaceAVKit::setVideoDimensions): ditto
1728         (WebVideoFullscreenInterfaceAVKit::setSeekableRanges): ditto
1729         (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): ditto
1730         (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): ditto
1731         (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): ditto
1732
1733 2014-07-14  Tibor Meszaros  <tmeszaros.u-szeged@partner.samsung.com>
1734
1735         Fix the !ENABLE(FILTERS) && !ENABLE(CSS_FILTERS) build after r167497
1736         https://bugs.webkit.org/show_bug.cgi?id=134679
1737
1738         Reviewed by Darin Adler.
1739
1740         * html/ImageData.cpp:
1741         * platform/graphics/cairo/ImageBufferCairo.cpp:
1742
1743 2014-07-14  Manuel Rego Casasnovas  <rego@igalia.com>
1744
1745         [CSS Grid Layout] Support sparse in auto-placement algorithm
1746         https://bugs.webkit.org/show_bug.cgi?id=134544
1747
1748         Reviewed by Sergio Villar Senin.
1749
1750         This patch implements sparse mode for auto-placement algorithm, which is
1751         the default mode in the new grid-auto-flow syntax. It keeps track of the
1752         auto-placement cursor in
1753         RenderGrid::placeAutoMajorAxisItemsOnGrid() and updates it accordingly
1754         when auto-positioned items are placed.
1755         If we're in dense mode it resets the cursor after each item (which keeps
1756         the old behavior that was using dense mode by default).
1757
1758         GridIterator has been adapted to look for empty areas from a given
1759         position in both directions.
1760
1761         Test: fast/css-grid-layout/grid-auto-flow-sparse.html
1762
1763         * rendering/RenderGrid.cpp:
1764         (WebCore::RenderGrid::GridIterator::GridIterator): Modify constructor to
1765         add an optional argument for the varying index. This allows to look for
1766         empty areas in both axis.
1767         (WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid): Defined the
1768         auto-placement cursor and rested after each item if we're in dense mode.
1769         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): Use auto-placement
1770         cursor to look for empty areas from the last auto-positioned item
1771         placed.
1772         * rendering/RenderGrid.h: Modify placeAutoMajorAxisItemOnGrid() header
1773         to receive the auto-placement cursor.
1774
1775 2014-07-14  Brent Fulgham  <bfulgham@apple.com>
1776
1777         [iOS] Some videos play as inline audio-only content
1778         https://bugs.webkit.org/show_bug.cgi?id=134898.
1779         <rdar://problem/17629379>
1780
1781         Reviewed by Eric Carlson.
1782
1783         Add a new 'presentationType' accessor that indicates if the media
1784         element is playing in 'audio' mode. This can happen if a video
1785         element plays an HLS stream that starts off in audio-only mode.
1786
1787         * html/HTMLMediaElement.cpp:
1788         (WebCore::HTMLMediaElement::presentationType): Added.
1789         * html/HTMLMediaElement.h:
1790         * platform/audio/MediaSession.cpp:
1791         (WebCore::MediaSession::presentationType): Added.
1792         * platform/audio/MediaSession.h:
1793         * platform/audio/MediaSessionManager.cpp: 
1794         (WebCore::MediaSessionManager::sessionRestrictsInlineVideoPlayback):
1795         Use the presentationType, rather than the mediaType to control
1796         inline playback behavior.
1797         * platform/audio/ios/AudioDestinationIOS.h:
1798         (WebCore::AudioDestinationMac::presentationType): Add presentationType.
1799         * platform/audio/mac/AudioDestinationMac.h:
1800         (WebCore::AudioDestinationMac::presentationType): Ditto.
1801
1802 2014-07-14  Bear Travis  <betravis@adobe.com>
1803
1804         [Feature Queries] Enable Feature Queries on Mac
1805         https://bugs.webkit.org/show_bug.cgi?id=134404
1806
1807         Reviewed by Antti Koivisto.
1808
1809         Enable Feature Queries on Mac and resume running the
1810         feature tests.
1811
1812         * Configurations/FeatureDefines.xcconfig: Turn on
1813         ENABLE_CSS3_CONDITIONAL_RULES.
1814
1815 2014-07-11  David Hyatt  <hyatt@apple.com>
1816
1817         <rdar://problem/17305458> Cannot interact with video controls in ePubs
1818         Bug 134836 - [New Multicolumn] Crawl to check for compositing between us and the enclosingPaginationLayer
1819         https://bugs.webkit.org/show_bug.cgi?id=134836
1820
1821         Reviewed by Dean Jackson.
1822
1823         The paginatedAndComposited bit being set in updateLayerPositions just didn't work, since compositing states
1824         can change without triggering that function. This patch just gets rid of the bit and does a crawl every time
1825         to check. This ensures that changes in compositing states don't necessitate any changes in pagination,
1826         since the lookup will always check the current compositing state.
1827         
1828         The new function that does this check is hasCompositedLayerInEnclosingPaginationChain.
1829         
1830         I have been unable to reproduce this issue, and this is therefore a purely speculative fix. I have no test
1831         case to provide because of this.
1832
1833         * rendering/RenderLayer.cpp:
1834         (WebCore::RenderLayer::RenderLayer):
1835         (WebCore::RenderLayer::updateLayerPositions):
1836         (WebCore::RenderLayer::hasCompositedLayerInEnclosingPaginationChain):
1837         (WebCore::RenderLayer::updatePagination):
1838         * rendering/RenderLayer.h:
1839
1840 2014-07-14  Zalan Bujtas  <zalan@apple.com>
1841
1842         Move composite bounds calculation to RenderLayerBacking.
1843         https://bugs.webkit.org/show_bug.cgi?id=134864
1844
1845         Reviewed by Darin Adler.
1846
1847         No change in functionality.
1848
1849         * rendering/RenderLayerBacking.cpp:
1850         (WebCore::RenderLayerBacking::updateCompositedBounds):
1851         * rendering/RenderLayerCompositor.cpp: it was just proxying the calculateLayerBounds()
1852         to the RenderLayer.
1853         (WebCore::RenderLayerCompositor::calculateCompositedBounds): Deleted.
1854         * rendering/RenderLayerCompositor.h:
1855
1856 2014-07-14  Tim Horton  <timothy_horton@apple.com>
1857
1858         Fix the build.
1859
1860         * platform/audio/MediaSessionManager.h:
1861
1862 2014-07-14  Eric Carlson  <eric.carlson@apple.com>
1863
1864         [Mac] don't enable low power audio mode on external output devices
1865         https://bugs.webkit.org/show_bug.cgi?id=134877
1866
1867         Reviewed by Sam Weinig.
1868
1869         No new tests, this deals with changes to the audio hardware at runtime.
1870
1871         * WebCore.xcodeproj/project.pbxproj: Remove AudioSessionListener.h.
1872         * WebCore.vcxproj/WebCore.vcxproj: Ditto.
1873
1874         * platform/audio/AudioHardwareListener.cpp:
1875         (WebCore::AudioHardwareListener::AudioHardwareListener): Initialize m_outputDeviceSupportsLowPowerMode
1876             to true on iOS.
1877         * platform/audio/AudioHardwareListener.h:
1878         (WebCore::AudioHardwareListener::outputDeviceSupportsLowPowerMode): New accessor.
1879         (WebCore::AudioHardwareListener::setHardwareActivity): New setter for derived classes.
1880         (WebCore::AudioHardwareListener::setOutputDeviceSupportsLowPowerMode): Ditto.
1881
1882         Remove AudioSessionListener interface, it wasn't being used.
1883         * platform/audio/AudioSession.cpp:
1884         (WebCore::AudioSession::addListener): Deleted.
1885         (WebCore::AudioSession::removeListener): Deleted.
1886         (WebCore::AudioSession::beganAudioInterruption): Deleted.
1887         (WebCore::AudioSession::endedAudioInterruption): Deleted.
1888         * platform/audio/AudioSession.h:
1889         * platform/audio/AudioSessionListener.h: Removed.
1890
1891         * platform/audio/MediaSessionManager.cpp:
1892         (WebCore::MediaSessionManager::addSession): Allocate the AudioHardwareListener if necessary.
1893         (WebCore::MediaSessionManager::removeSession): Free the AudioHardwareListener if necessary.
1894         (WebCore::MediaSessionManager::audioOutputDeviceChanged): AudioHardwareListener client interface
1895             called when the output device changes, call updateSessionState to make sure we are using
1896             the correct buffer size.
1897         * platform/audio/MediaSessionManager.h:
1898
1899         * platform/audio/ios/AudioDestinationIOS.h:
1900         * platform/audio/ios/AudioSessionIOS.mm:
1901         (WebCore::AudioSessionPrivate::AudioSessionPrivate): Drive-by cleanup, remove ObjC helper object
1902             that was used to listen for OS notifications, it is no longer used.
1903         (SOFT_LINK_POINTER): Deleted.
1904         (-[WebAudioSessionHelper initWithCallback:]): Deleted.
1905         (-[WebAudioSessionHelper dealloc]): Deleted.
1906         (-[WebAudioSessionHelper interruption:]): Deleted.
1907
1908         * platform/audio/mac/AudioHardwareListenerMac.cpp:
1909         (WebCore::currentDeviceSupportsLowPowerBufferSize): New, return true only if using build-in 
1910             transport device.
1911         (WebCore::processIsRunningPropertyDescriptor): Return reference to static AudioObjectPropertyAddress
1912             for kAudioHardwarePropertyProcessIsRunning instead of declaring one in every method
1913             that needs one.
1914         (WebCore::outputDevicePropertyDescriptor): Return reference to static AudioObjectPropertyAddress
1915             for kAudioHardwarePropertyDefaultOutputDevice.
1916         (WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac): Restructure and add audio object
1917             listener for default output device.
1918         (WebCore::AudioHardwareListenerMac::~AudioHardwareListenerMac): *Remove* listener audio object
1919             property listener instead of *Adding* a new one. Remove new listener.
1920         (WebCore::AudioHardwareListenerMac::propertyChanged): Enumerate the properties that changed,
1921             call appropriate method.
1922         (WebCore::AudioHardwareListenerMac::processIsRunningChanged): Renamed from setHardwareActive, 
1923             cleanup.
1924         (WebCore::AudioHardwareListenerMac::outputDeviceChanged): New, call client.audioHardwareOutputDeviceChanged.
1925         (WebCore::AudioHardwareListenerMac::setHardwareActive): Deleted, renamed processIsRunningChanged.
1926         * platform/audio/mac/AudioHardwareListenerMac.h:
1927
1928         * platform/audio/mac/MediaSessionManagerMac.cpp:
1929         (MediaSessionManager::updateSessionState): Only set the output buffer size to 4K when hardware
1930             supports it.
1931
1932 2014-07-13  Benjamin Poulain  <benjamin@webkit.org>
1933
1934         Remove SelectorCheckerFastPath from the style resolution algorithm
1935         https://bugs.webkit.org/show_bug.cgi?id=134866
1936
1937         Reviewed by Antti Koivisto.
1938
1939         SelectorCheckerFastPath is now pure overhead because it can almost never match
1940         if the CSS JIT was unable to compile.
1941
1942         * css/ElementRuleCollector.cpp:
1943         (WebCore::ElementRuleCollector::ruleMatches):
1944         The "pre-filter" behind fastCheckableSelector had two parts:
1945         1) Filtering the pseudoID.
1946         2) Filtering on the rule hash.
1947
1948         The first part has been generalized (RuleDatacanMatchPseudoElement())
1949         and moved to collectMatchingRulesForList(). 
1950
1951         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
1952         * css/RuleSet.cpp:
1953         (WebCore::selectorCanMatchPseudoElement):
1954         (WebCore::RuleData::RuleData):
1955         (WebCore::RuleSet::addRegionRule):
1956         (WebCore::RuleSet::addRulesFromSheet):
1957         * css/RuleSet.h:
1958         (WebCore::RuleData::canMatchPseudoElement):
1959         (WebCore::RuleData::hasFastCheckableSelector): Deleted.
1960         * css/StyleResolver.cpp:
1961
1962 2014-07-13  Benjamin Poulain  <benjamin@webkit.org>
1963
1964         Remove an useless check from SelectorChecker
1965         https://bugs.webkit.org/show_bug.cgi?id=134868
1966
1967         Reviewed by Darin Adler.
1968
1969         * css/SelectorChecker.cpp:
1970         (WebCore::SelectorChecker::matchRecursively):
1971         The condition of this if() branch can never be met for the mode "QueryingRules".
1972
1973         The next condition in that if() is "dynamicPseudo != NOPSEUDO", which implies
1974         a pseudo element was matched prior to the current context/simple selector.
1975         This cannot happen with QueryingRules, since we never match pseudo elements for
1976         SelectorQuery.
1977
1978 2014-07-12  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
1979
1980         Elements with rendering disabled due to dimensions should not contribute to parent bounding box
1981         https://bugs.webkit.org/show_bug.cgi?id=134184
1982
1983         Reviewed by Dirk Schulze.
1984
1985         SVG elements that have rendering disabled should not contribute to any ancestor elements bounding box.
1986         Examples of elements with rendering disabled:
1987         - basic shape with width <= 0 or height <= 0
1988         - path with no path data (d attribute missing or empty)
1989         - polyline or polygon element with no point data (points attribute missing or empty)
1990
1991         To achieve this a method (isRenderingDisabled) was added to RenderSVGShape and it's derived classes.
1992         This is used to determine if an element is included when creating the union of child bounding boxes
1993         in a container element.
1994
1995         Tests: svg/custom/GetBBox-path-nodata.html
1996                svg/custom/GetBBox-polygon-nodata.html
1997                svg/custom/GetBBox-polyline-nodata.html
1998                svg/custom/getBBox-container-hiddenchild.html
1999
2000         * rendering/svg/RenderSVGEllipse.cpp:
2001         (WebCore::RenderSVGEllipse::isRenderingDisabled):
2002         New method added. Checks bounding box to determine if rendering is disabled.
2003         * rendering/svg/RenderSVGEllipse.h:
2004         * rendering/svg/RenderSVGPath.cpp:
2005         (WebCore::RenderSVGPath::isRenderingDisabled):
2006         New method added. Checks bounding box to determine if rendering is disabled.
2007         * rendering/svg/RenderSVGPath.h:
2008         * rendering/svg/RenderSVGRect.cpp:
2009         (WebCore::RenderSVGRect::isRenderingDisabled):
2010         New method added. Checks bounding box to determine if rendering is disabled.
2011         * rendering/svg/RenderSVGRect.h:
2012         * rendering/svg/RenderSVGShape.h:
2013         (WebCore::RenderSVGShape::isRenderingDisabled):
2014         New method added. Always returns false so that derived classes that do not
2015         implement this method retain the existing behaviour.
2016         * rendering/svg/SVGRenderSupport.cpp:
2017         (WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
2018         For each element potentially being included in the unioned bounding box of
2019         a container, check isRenderingDisabled and skip that element if true.
2020
2021         * rendering/svg/RenderSVGEllipse.cpp:
2022         (WebCore::RenderSVGEllipse::isRenderingDisabled):
2023         * rendering/svg/RenderSVGEllipse.h:
2024         * rendering/svg/RenderSVGPath.cpp:
2025         (WebCore::RenderSVGPath::isRenderingDisabled):
2026         * rendering/svg/RenderSVGPath.h:
2027         * rendering/svg/RenderSVGRect.cpp:
2028         (WebCore::RenderSVGRect::isRenderingDisabled):
2029         * rendering/svg/RenderSVGRect.h:
2030         * rendering/svg/RenderSVGShape.h:
2031         * rendering/svg/SVGRenderSupport.cpp:
2032         (WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
2033
2034 2014-07-12  Benjamin Poulain  <benjamin@webkit.org>
2035
2036         Rename selectorListContainsUncommonAttributeSelector() to selectorListContainsAttributeSelector()
2037         https://bugs.webkit.org/show_bug.cgi?id=134862
2038
2039         Reviewed by Sam Weinig.
2040
2041         Unlike containsUncommonAttributeSelector(), selectorListContainsUncommonAttributeSelector() does not
2042         evaluate the attribute for "uncommon" types.
2043
2044         It would be possible to change the function instead to evaluate common attributes based
2045         on the match type and the pseudo class type. Such change would be more risky
2046         and we would get very little benefit from it, I leave that for later if that ever becomes useful.
2047
2048         * css/RuleSet.cpp:
2049         (WebCore::selectorListContainsAttributeSelector):
2050         (WebCore::containsUncommonAttributeSelector):
2051         (WebCore::selectorListContainsUncommonAttributeSelector): Deleted.
2052
2053 2014-07-12  Zan Dobersek  <zdobersek@igalia.com>
2054
2055         Use braced-init-list to create one-item Vector object in insertPerformanceEntry
2056         https://bugs.webkit.org/show_bug.cgi?id=133675
2057
2058         Reviewed by Darin Adler.
2059
2060         * page/PerformanceUserTiming.cpp:
2061         (WebCore::insertPerformanceEntry): Avoid wasting three lines for creating a
2062         Vector object with just one item that in the end gets copied. Use the
2063         braced-init-list syntax instead, leveraging Vector's std::initializer_list
2064         constructor.
2065
2066 2014-07-12  Allan Sandfeld Jensen  <allan.jensen@digia.com>
2067
2068         Memory leaks with autoLoadImages off
2069         https://bugs.webkit.org/show_bug.cgi?id=124411
2070
2071         Reviewed by Darin Adler.
2072
2073         Do not emit notifyFinished for images with deferred load,
2074         and allow deferred loads to be cancelled.
2075
2076         * loader/cache/CachedResource.cpp:
2077         (WebCore::CachedResource::checkNotify):
2078         (WebCore::CachedResource::cancelLoad):
2079
2080 2014-07-11  Jer Noble  <jer.noble@apple.com>
2081
2082         [MSE] http/tests/media/media-source/mediasource-duration.html is failing.
2083         https://bugs.webkit.org/show_bug.cgi?id=134852
2084
2085         Reviewed by Eric Carlson.
2086
2087         Fixes the following tests:
2088         http/tests/media/media-source/mediasource-config-change-mp4-a-bitrate.html
2089         http/tests/media/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
2090         http/tests/media/media-source/mediasource-config-change-mp4-av-video-bitrate.html
2091         http/tests/media/media-source/mediasource-config-change-mp4-v-bitrate.html
2092         http/tests/media/media-source/mediasource-config-change-mp4-v-framerate.html
2093         http/tests/media/media-source/mediasource-duration.html
2094         http/tests/media/media-source/mediasource-play.html
2095
2096         The primary change necessary to fix the mediasource-duration.html test was to add support
2097         for delaying the completion of a seek operation until the HTMLMediaElement's readyState
2098         rises to > HAVE_CURRENT_DATA. This is accomplished by modifying MediaSourcePrivate to have
2099         waitForSeekCompleted() and seekCompleted() virtual methods. These are called by MediaSource
2100         when a seek operation results in the current time moving outside the currently buffered time
2101         ranges, and when an append operation results in the readyState changing, respectively.
2102
2103         A number of other drive-by fixes were necessary to get this test fully passing, as noted
2104         below.
2105
2106         Make the MediaSource the primary owner of the media's duration, rather than the MediaSourcePrivate.
2107         Move the MediaSourcePrivateClient pointer to the MediaSourcePrivate from the MediaPlayerPrivate, so
2108         the MediaSource's duration can be retrieved.  While we're at it, do the same thing for buffered.
2109
2110         * Modules/mediasource/MediaSource.cpp:
2111         (WebCore::MediaSource::MediaSource): Initialize m_duration.
2112         (WebCore::MediaSource::duration): Simple accessor.
2113         (WebCore::MediaSource::setDurationInternal): Bring 'duration change algorithm' up to spec.
2114         (WebCore::MediaSource::setReadyState): Reset m_duration on close.
2115         * Modules/mediasource/MediaSource.h:
2116         * platform/graphics/MediaSourcePrivate.h:
2117         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2118         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Do not call setPrivateAndOpen().
2119         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationDouble): Pass through to MediaSourcePrivateAVFObjC.
2120         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::buffered): Ditto.
2121         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2122         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2123         (WebCore::MediaSourcePrivateAVFObjC::create): Call setPrivateAndOpen().
2124         (WebCore::MediaSourcePrivateAVFObjC::MediaSourcePrivateAVFObjC): Set m_client.
2125         (WebCore::MediaSourcePrivateAVFObjC::duration): Pass through to MediaSourcePrivateClient.
2126         (WebCore::MediaSourcePrivateAVFObjC::buffered): Ditto.
2127         (WebCore::MediaSourcePrivateAVFObjC::durationChanged): Pass through to MediaPlayerPrivateMediaSourceAVFObjC.
2128         (WebCore::MediaSourcePrivateAVFObjC::setDuration): Deleted.
2129         * platform/graphics/gstreamer/MediaSourceGStreamer.cpp:
2130         (WebCore::MediaSourceGStreamer::open): Pass in MediaSourcePrivateClient.
2131         (WebCore::MediaSourceGStreamer::MediaSourceGStreamer): Initialize m_mediaSource.
2132         (WebCore::MediaSourceGStreamer::durationChanged): Retrieve the duration from MediaSourcePrivateClient.
2133         (WebCore::MediaSourceGStreamer::markEndOfStream): Remove unnecssary ASSERT.
2134         (WebCore::MediaSourceGStreamer::unmarkEndOfStream): Ditto.
2135         (WebCore::MediaSourceGStreamer::setDuration): Deleted.
2136         * platform/graphics/gstreamer/MediaSourceGStreamer.h:
2137         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2138         (WebCore::MockMediaPlayerMediaSource::load): Do not call setPrivateAndOpen().
2139         (WebCore::MockMediaPlayerMediaSource::buffered): Pass through to MockMediaSourcePrivate.
2140         (WebCore::MockMediaPlayerMediaSource::durationDouble): Ditto.
2141         (WebCore::MockMediaPlayerMediaSource::advanceCurrentTime): Ditto.
2142         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2143         (WebCore::MockMediaSourcePrivate::create): Call setPrivateAndOpen().
2144         (WebCore::MockMediaSourcePrivate::MockMediaSourcePrivate): Set m_client.
2145         (WebCore::MockMediaSourcePrivate::duration): Pass through to MediaSourcePrivateClient.
2146         (WebCore::MockMediaSourcePrivate::buffered): Ditto.
2147         (WebCore::MockMediaSourcePrivate::durationChanged): Pass thorugh to MockMediaPlayerMediaSource.
2148         (WebCore::MockMediaSourcePrivate::setDuration): Deleted.
2149
2150         Route seekToTime through MediaSource, rather than through MediaSourcePrivate, so that
2151         the time can be compared against the buffered ranges, and trigger the delay of the seek
2152         operation if necessary. Add a seekTimer to MediaPlayerPrivateMediaSourceAVFObjC, as this
2153         guarantees the order of asynchronous operations, rather than callOnMainThread, which can
2154         cause async operations to occur out of order.
2155
2156         * Modules/mediasource/MediaSource.cpp:
2157         (WebCore::MediaSource::seekToTime): Bring up to spec.
2158         (WebCore::MediaSource::completeSeek): Ditto.
2159         (WebCore::MediaSource::monitorSourceBuffers): Call completeSeek() when appropriate.
2160         * Modules/mediasource/SourceBuffer.cpp:
2161         (WebCore::SourceBuffer::sourceBufferPrivateSeekToTime): Deleted.
2162         (WebCore::SourceBuffer::seekToTime): Renamed from sourceBufferPrivateSeekToTime().
2163         * platform/graphics/MediaSourcePrivate.h:
2164         * platform/graphics/MediaSourcePrivateClient.h:
2165         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2166         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2167         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): Add seekTimer. Only
2168             call timeChanged() if no longer seeking, thereby triggering a 'seeked' event.
2169         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC): Clear m_seekTimer.
2170         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance): Use m_seekTimer.
2171         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekTimerFired): Call seekInternal.
2172         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal): Add logging.
2173         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): Added.
2174         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Added; trigger 'seeked'.
2175         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): No longer attempt to finish seek when
2176             readyState changes here; this has been moved up to MediaSource.cpp.
2177         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2178         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2179         (WebCore::MediaSourcePrivateAVFObjC::waitForSeekCompleted): Pass through to MediaPlayerPrivateMediaSourceAVFObjC.
2180         (WebCore::MediaSourcePrivateAVFObjC::seekCompleted): Ditto.
2181         (WebCore::MediaSourcePrivateAVFObjC::seekToTime): Pass through to MediaSourcePrivateClient.
2182         (WebCore::MediaSourcePrivateAVFObjC::fastSeekTimeForMediaTime): Ditto.
2183         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2184         (WebCore::MockMediaPlayerMediaSource::MockMediaPlayerMediaSource): Initialize m_seekCompleted.
2185         (WebCore::MockMediaPlayerMediaSource::seeking): Check for an uncompleted seek operation. 
2186         (WebCore::MockMediaPlayerMediaSource::seekWithTolerance): Ditto.
2187         (WebCore::MockMediaPlayerMediaSource::waitForSeekCompleted): Added.
2188         (WebCore::MockMediaPlayerMediaSource::seekCompleted): Added; trigger 'seeked'.
2189         * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
2190         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2191         (WebCore::MockMediaSourcePrivate::waitForSeekCompleted): Pass through to MockMediaPlayerMediaSource.
2192         (WebCore::MockMediaSourcePrivate::seekCompleted): Ditto.
2193         * platform/mock/mediasource/MockMediaSourcePrivate.h:
2194
2195         Drive-by fixes.
2196
2197         * Modules/mediasource/MediaSource.cpp:
2198         (WebCore::MediaSource::streamEndedWithError): Re-order the steps in streamEndedWithError()
2199             to avoid the MediaSource being closed and re-opened by the resulting duration change
2200             operation.
2201         * Modules/mediasource/MediaSource.h:
2202         * Modules/mediasource/SourceBuffer.cpp:
2203         (WebCore::SourceBuffer::remove): Added logging.
2204         (WebCore::SourceBuffer::removeCodedFrames): Ditto.
2205         (WebCore::SourceBuffer::hasFutureTime): Swap an ASSERT for an early-return; it's possible
2206             for currentTime() to be outside of a buffered area.
2207         * Modules/mediasource/SourceBuffer.h:
2208         * html/HTMLMediaElement.cpp:
2209         (WebCore::HTMLMediaElement::parseAttribute): Do not issue an additional 'timeupdate' event
2210             after finishSeek() issues one of its own.
2211         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2212         (WebCore::globalDataParserQueue): Allow parsing operations to happen concurrently on
2213             background queues.
2214
2215 2014-07-12  Eric Carlson  <eric.carlson@apple.com>
2216
2217         [iOS] update control type when playback state changes
2218         https://bugs.webkit.org/show_bug.cgi?id=134856
2219
2220         Reviewed by Dean Jackson.
2221
2222         Check to make sure the correct type of media controls are showing when playback state
2223         changes so we don't end up with the wrong type of controls during playback.
2224
2225         * Modules/mediacontrols/mediaControlsApple.js: 
2226         (Controller.prototype.HandledVideoEvents): Drive-by fix, call handlePlay on 'playing' instead
2227             of 'play' so controls don't hide too early.
2228         * Modules/mediacontrols/mediaControlsiOS.js:
2229         (ControllerIOS.prototype.setPlaying): New, call updateControls to make sure inline
2230             controls are shown when appropriate.
2231
2232 2014-07-12  Dean Jackson  <dino@apple.com>
2233
2234         [iOS Media] Start playback button should indicate when it can't play
2235         https://bugs.webkit.org/show_bug.cgi?id=134851
2236
2237         Post-commit review with Eric Carlson on IRC.
2238
2239         * Modules/mediacontrols/mediaControlsiOS.js:
2240         (ControllerIOS.prototype.updateStatusDisplay): Remove the line that sets the
2241         class on the inline play button.
2242
2243 2014-07-11  Dean Jackson  <dino@apple.com>
2244
2245         [iOS Media] Start playback button should indicate when it can't play
2246         https://bugs.webkit.org/show_bug.cgi?id=134851
2247
2248         Reviewed by Sam Weinig.
2249
2250         If a video element has errors and cannot play, then the start
2251         playback button should use the "broken" icon.
2252
2253         * Modules/mediacontrols/mediaControlsApple.js: Add a new "failed" class.
2254         * Modules/mediacontrols/mediaControlsiOS.js:
2255         (ControllerIOS.prototype.shouldHaveStartPlaybackButton): We need a playback button
2256         even when there is an error.
2257         (ControllerIOS.prototype.handleWirelessPickerButtonTouchStart): Don't offer Airplay
2258         if we're in an error state.
2259         (ControllerIOS.prototype.updateStatusDisplay): Set the "failed" class on
2260         the playback buttons if we are in an error state.
2261
2262 2014-07-11  Benjamin Poulain  <benjamin@webkit.org>
2263
2264         Partition the CSS rules based on the most specific filter of the rightmost fragment
2265         https://bugs.webkit.org/show_bug.cgi?id=134828
2266
2267         Reviewed by Andreas Kling.
2268
2269         Previously, RuleSet was partitioning each rule based on the rightmost filter.
2270         While fast, this had the side effect of putting many selectors with ID match in the class
2271         bucket (because the selectors are generally written starting with the ID).
2272
2273         This patch replace the code of findBestRuleSetAndAdd() by a simple loop going over all
2274         the simple selectors in the rightmost fragment to find the best bucket.
2275
2276         * css/ElementRuleCollector.cpp:
2277         (WebCore::ElementRuleCollector::ruleMatches):
2278         * css/RuleSet.cpp:
2279         (WebCore::isSelectorMatchingHTMLBasedOnRuleHash):
2280         I unified ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() and hasMultipartSelector().
2281
2282         (WebCore::RuleData::RuleData):
2283         (WebCore::rulesCountForName):
2284         (WebCore::RuleSet::addRule):
2285         I removed the recursive part of findBestRuleSetAndAdd() (which was wrong anyway). The function
2286         was useless so I just moved the algorithm to addRule() directly.
2287
2288         We first loop over all the CSSSelectors related by SubSelector, this correspond to the rightmost fragment.
2289         If a filter with high specificity is found, we add the rule immediately and end there.
2290         If a filter that is not very specific is found, we keep a pointer to the selector to use it later.
2291
2292         (WebCore::RuleSet::findBestRuleSetAndAdd): Deleted.
2293         * css/RuleSet.h:
2294         (WebCore::RuleData::hasMultipartSelector): Deleted.
2295
2296 2014-07-11  Alex Christensen  <achristensen@webkit.org>
2297
2298         [WinCairo] Unreviewed build fix after r170937.
2299
2300         * WebCore.vcxproj/WebCoreGeneratedWinCairo.make:
2301         Update and apply changes applied to WebCoreGenerated.make in r170937.
2302
2303 2014-07-11  Joseph Pecoraro  <pecoraro@apple.com>
2304
2305         Web Inspector: Crash when using a stale InspectableNode Node
2306         https://bugs.webkit.org/show_bug.cgi?id=134849
2307
2308         Reviewed by Timothy Hatcher.
2309
2310         * inspector/PageConsoleAgent.cpp:
2311
2312 2014-07-11  Jer Noble  <jer.noble@apple.com>
2313
2314         [MSE] Separate MediaSource logging into its own log channel
2315         https://bugs.webkit.org/show_bug.cgi?id=134809
2316
2317         Reviewed by Eric Carlson.
2318
2319         Separate out MediaSource logging (which can be quite verbose) into its own log channel,
2320         distinct from the Media log channel. Add some per-sample logging and further sequester that
2321         logging into its own MediaSourceSamples log channel.
2322
2323         Add the MediaSource and MediaSourceSamples channels:
2324         * platform/Logging.h:
2325
2326         Move LOG(Media) -> LOG(MediaSource):
2327         * Modules/mediasource/MediaSource.cpp:
2328         (WebCore::MediaSource::MediaSource):
2329         (WebCore::MediaSource::~MediaSource):
2330         (WebCore::MediaSource::setReadyState):
2331         (WebCore::MediaSource::addSourceBuffer):
2332         (WebCore::MediaSource::removeSourceBuffer):
2333         (WebCore::MediaSource::isTypeSupported):
2334         * Modules/mediasource/SourceBuffer.cpp:
2335         (WebCore::SourceBuffer::sourceBufferPrivateSeekToTime):
2336         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
2337         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2338         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
2339         (WebCore::SourceBuffer::provideMediaData):
2340         (WebCore::SourceBuffer::monitorBufferingRate):
2341         (WebCore::SourceBuffer::textTrackAddCues):
2342         (WebCore::SourceBuffer::hasFutureTime):
2343         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2344         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2345         (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
2346         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
2347         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
2348         (WebCore::SourceBufferPrivateAVFObjC::append):
2349         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
2350         (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
2351         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
2352         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2353
2354 2014-07-11  Brady Eidson  <beidson@apple.com>
2355
2356         Phone numbers that span two lines are not detected.
2357         <rdar://problem/17601146> and https://bugs.webkit.org/show_bug.cgi?id=134808
2358
2359         Reviewed by Tim Horton.
2360
2361         * editing/Editor.cpp:
2362         (WebCore::Editor::scanSelectionForTelephoneNumbers): After scanning a range from the TextIterator,
2363             create an "edge range" window around the end of the TextIterator range, and scan it.
2364             Also make sure to not accumulate duplicate ranges that might have showed up in both the
2365             TextIterator range and the edge window range.
2366
2367 2014-07-11  Enrica Casucci  <enrica@apple.com>
2368
2369         Implement textStylingAtPosition in WK2.
2370         https://bugs.webkit.org/show_bug.cgi?id=134843
2371         <rdar://problem/17614981>
2372         
2373         Reviewed by Benjamin Poulain.
2374
2375         Adding some exports and making styleForSelectionStart public.
2376
2377         * WebCore.exp.in:
2378         * editing/Editor.h:
2379
2380 2014-07-11  Zalan Bujtas  <zalan@apple.com>
2381
2382         REGRESSION (r168868): eBay 'see all' links fail due to different JS bindings conversion behavior.
2383         https://bugs.webkit.org/show_bug.cgi?id=134841
2384         <rdar://problem/17577563>
2385
2386         Reviewed by Simon Fraser.
2387
2388         Revert back to type int for Element.scroll* APIs in order to preserve exception handling
2389         behavior.
2390
2391         Test: cssom/non-subpixel-scroll-top-left-values.html
2392
2393         * dom/Element.cpp:
2394         (WebCore::Element::scrollLeft):
2395         (WebCore::Element::scrollTop):
2396         (WebCore::Element::setScrollLeft):
2397         (WebCore::Element::setScrollTop):
2398         (WebCore::Element::scrollWidth):
2399         (WebCore::Element::scrollHeight):
2400         * dom/Element.h:
2401         * dom/Element.idl:
2402         * html/HTMLBodyElement.cpp:
2403         (WebCore::adjustForZoom):
2404         (WebCore::HTMLBodyElement::scrollLeft):
2405         (WebCore::HTMLBodyElement::setScrollLeft):
2406         (WebCore::HTMLBodyElement::scrollTop):
2407         (WebCore::HTMLBodyElement::setScrollTop):
2408         (WebCore::HTMLBodyElement::scrollHeight):
2409         (WebCore::HTMLBodyElement::scrollWidth):
2410         * html/HTMLBodyElement.h:
2411
2412 2014-07-11  Joseph Pecoraro  <pecoraro@apple.com>
2413
2414         Web Inspector: Debugger Pause button does not work
2415         https://bugs.webkit.org/show_bug.cgi?id=134785
2416
2417         Reviewed by Timothy Hatcher.
2418
2419         * CMakeLists.txt:
2420         * DerivedSources.make:
2421         * inspector/CommandLineAPIModuleSource.js:
2422         Minification strips the sourceURL command. Add it back with minification.
2423
2424 2014-07-11  Andreas Kling  <akling@apple.com>
2425
2426         Use the bare minimum tile coverage rect when under memory pressure.
2427         <https://webkit.org/b/134837>
2428
2429         When the browser is under critical memory pressure, don't generate any
2430         more tiles than are needed to cover the exposed viewport rect.
2431
2432         Reviewed by Pratik Solanki.
2433
2434         * page/FrameView.cpp:
2435         (WebCore::FrameView::computeCoverageRect):
2436
2437 2014-07-11  Javier Fernandez  <jfernandez@igalia.com>
2438
2439         [CSS Grid Layout] Implement justify-self css property
2440         https://bugs.webkit.org/show_bug.cgi?id=134419
2441
2442         Reviewed by Dean Jackson.
2443
2444         This change adds the justify-self property from CSS 3 Box Alignment
2445         and implements the parsing.
2446
2447         From Blink r164685 by <jchaffraix@chromium.org>
2448
2449         Test: fast/css/parse-justify-self.html
2450
2451         * css/CSSComputedStyleDeclaration.cpp:
2452         (WebCore::ComputedStyleExtractor::propertyValue):
2453         * css/CSSParser.cpp:
2454         (WebCore::isValidKeywordPropertyAndValue):
2455         (WebCore::CSSParser::parseValue):
2456         (WebCore::isItemPositionKeyword):
2457         (WebCore::CSSParser::parseJustifySelf):
2458         * css/CSSParser.h:
2459         * css/CSSPrimitiveValueMappings.h:
2460         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2461         (WebCore::CSSPrimitiveValue::operator EJustifySelf):
2462         (WebCore::CSSPrimitiveValue::operator EJustifySelfOverflowAlignment):
2463         * css/CSSPropertyNames.in:
2464         * css/CSSValueKeywords.in:
2465         * css/DeprecatedStyleBuilder.cpp:
2466         (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
2467         * css/StyleResolver.cpp:
2468         (WebCore::StyleResolver::applyProperty):
2469         * rendering/style/RenderStyle.h:
2470         * rendering/style/RenderStyleConstants.h:
2471         * rendering/style/StyleRareNonInheritedData.cpp:
2472         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2473         (WebCore::StyleRareNonInheritedData::operator==):
2474         * rendering/style/StyleRareNonInheritedData.h:
2475
2476 2014-07-11  Bear Travis  <betravis@adobe.com>
2477
2478         [Feature Queries] Feature Query CSS Grammar Productions Should Return a Value
2479         https://bugs.webkit.org/show_bug.cgi?id=134810
2480
2481         Reviewed by Antti Koivisto.
2482
2483         The parsing return values are used to determine if a feature query is valid. Two
2484         grammar productions have been updated to correctly return a value.
2485
2486         Tests exist for this feature but will not be run until the feature is turned on.
2487         See https://bugs.webkit.org/show_bug.cgi?id=134404.
2488
2489         * css/CSSGrammar.y.in: Adding return values for two valid feature query productions.
2490
2491 2014-07-10  Brent Fulgham  <bfulgham@apple.com>
2492
2493         Use a separate backdrop element to allow cues to have highlight and background color
2494         https://bugs.webkit.org/show_bug.cgi?id=134821
2495         <rdar://problem/15999721>
2496
2497         Reviewed by Eric Carlson.
2498
2499         Add a new <div> element wrapping the existing cue <span>. This allows
2500         us to have a highlight on the cue (in the <span> background), as well
2501         as an overall background color.
2502
2503         * Modules/mediacontrols/mediaControlsApple.css:
2504         (video::-webkit-media-text-track-display-backdrop): New markup for
2505         the backdrop element of the caption.
2506         * html/track/VTTCue.cpp:
2507         (WebCore::VTTCue::cueBackdropShadowPseudoId): Added to
2508         allow user customization of the cue backdrop.
2509         (WebCore::VTTCue::initialize): Rename the old "m_cueBackgroundBox" to
2510         "m_cueHighlightBox" and add a new "m_cueBackdropBox" member.
2511         (WebCore::VTTCue::updateDisplayTree): Update for m_cueHighlightBox.
2512         (WebCore::VTTCue::getDisplayTree): Make m_cueHighlightBox a child
2513         of the new m_cueBackdropBox element, and add m_cueBackdropBox to
2514         the display tree.
2515         * html/track/VTTCue.h:
2516         (WebCore::VTTCue::element):
2517         * page/CaptionUserPreferencesMediaAF.cpp:
2518         (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
2519         Fix for missing caption style updates. Even if we are already
2520         listening for caption changes, we still want to update the new
2521         instance's style sheet to match.
2522         (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride):
2523         * rendering/RenderVTTCue.cpp:
2524         (WebCore::RenderVTTCue::initializeLayoutParameters): Take the new
2525         <div> into consideration when looking for the Cue text element.
2526
2527 2014-07-11  Zalan Bujtas  <zalan@apple.com>
2528
2529         Subpixel layout: return integral results for offset*, client*, scroll* by default.
2530         https://bugs.webkit.org/show_bug.cgi?id=134651
2531
2532         Reviewed by Simon Fraser.
2533
2534         Revert to returning integral values for Element.offset* client* scroll* by default.
2535         Fractional values break number of sites(tight design) and JS frameworks(fail to handle fractional values).
2536
2537         Since snapped dimension depends on both the original point and the width/height of the box,
2538         we need to call RenderBoxModelObject::pixelSnapped*() helpers, instead of round().
2539
2540         Covered by existing tests
2541  
2542         * dom/Element.cpp:
2543         (WebCore::subpixelMetricsEnabled):
2544         (WebCore::convertToNonSubpixelValueIfNeeded):
2545         (WebCore::Element::offsetLeft):
2546         (WebCore::Element::offsetTop):
2547         (WebCore::Element::offsetWidth):
2548         (WebCore::Element::offsetHeight):
2549         (WebCore::Element::clientLeft):
2550         (WebCore::Element::clientTop):
2551         (WebCore::Element::clientWidth):
2552         (WebCore::Element::clientHeight):
2553         * page/Settings.in:
2554
2555 2014-07-11  Zalan Bujtas  <zalan@apple.com>
2556
2557         Subpixel rendering: icloud.com password arrow has clipped circle at some window sizes.
2558         https://bugs.webkit.org/show_bug.cgi?id=134824
2559         <rdar://problem/17612729>
2560
2561         Reviewed by Simon Fraser.
2562
2563         Transparent layer clipping needs device pixel offset adjusting.
2564
2565         Test: fast/layers/wrong-clipping-semi-transparent-compositing-layer-on-subpixel-position.html
2566
2567         * rendering/RenderLayer.cpp:
2568         (WebCore::RenderLayer::beginTransparencyLayers):
2569         (WebCore::RenderLayer::paintLayer):
2570         (WebCore::RenderLayer::paintLayerContents):
2571         (WebCore::RenderLayer::paintBackgroundForFragments):
2572         (WebCore::RenderLayer::paintForegroundForFragments):
2573         * rendering/RenderLayer.h:
2574
2575 2014-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2576
2577         Unreviewed. Remove unused file.
2578
2579         * html/shadow/MediaControlsGtk.h: Removed.
2580
2581 2014-07-11  Manuel Rego Casasnovas  <rego@igalia.com>
2582
2583         [CSS Grid Layout] Update grid-auto-flow to the new syntax
2584         https://bugs.webkit.org/show_bug.cgi?id=134057
2585
2586         Reviewed by Sergio Villar Senin.
2587
2588         In last versions of the spec grid-auto-flow syntax has changed. New
2589         syntax is:
2590         [ row | column ] && dense? | stack && [ row | column ]?
2591
2592         Implemented parsing for new syntax and added/modified test cases in
2593         current layout tests.
2594
2595         For the moment, the implementation keeps working in the same way, but
2596         using "stack" value for grid-auto-flow property instead of "none". This
2597         should be fixed in a follow-up patch once "stack" is properly
2598         implemented.
2599
2600         Also "dense" needs to be reviewed. Right now auto-placement algorithm is
2601         always "dense" and never "sparse".
2602
2603         No new tests, update current tests to add new cases.
2604
2605         * css/CSSComputedStyleDeclaration.cpp:
2606         (WebCore::ComputedStyleExtractor::propertyValue): Adapt to new syntax.
2607         * css/CSSParser.cpp:
2608         (WebCore::isValidKeywordPropertyAndValue): Removed grid-auto-flow as it
2609         is not a keyword anymore.
2610         (WebCore::isKeywordPropertyID): Ditto.
2611         (WebCore::CSSParser::parseValue): Add specific method for parsing
2612         grid-auto-flow.
2613         (WebCore::CSSParser::parseGridShorthand): Adapt parsing for
2614         grid-auto-flow property inside the shorthand.
2615         (WebCore::isValidGridAutoFlowId): Helper method to check if the CSSValue
2616         id is a valid keyword for grid-auto-flow property.
2617         (WebCore::CSSParser::parseGridAutoFlow): Implement new parsing for
2618         grid-auto-flow.
2619         * css/CSSParser.h: Method header for grid-auto-flow parsing.
2620         * css/CSSPrimitiveValueMappings.h:
2621         (WebCore::CSSPrimitiveValue::operator GridAutoFlow): Deleted.
2622         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Deleted.
2623         * css/CSSValueKeywords.in: Add new keywords required by grid-auto-flow:
2624         "dense" and "stack".
2625         * css/DeprecatedStyleBuilder.cpp:
2626         (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Remove
2627         default handler as grid-auto-flow is not a keyword now.
2628         * css/StyleResolver.cpp:
2629         (WebCore::StyleResolver::applyProperty): Implement particular handler
2630         for new grid-auto-flow syntax.
2631         * rendering/RenderGrid.cpp:
2632         (WebCore::RenderGrid::placeItemsOnGrid): Keep old "none" behavior as
2633         "stack" behavior for the moment.
2634         (WebCore::RenderGrid::autoPlacementMajorAxisDirection): Use the new
2635         helper methods in RenderStyle.
2636         (WebCore::RenderGrid::autoPlacementMinorAxisDirection): Ditto.
2637         * rendering/style/GridResolvedPosition.cpp:
2638         (WebCore::GridResolvedPosition::resolveGridPositionsFromStyle): Again
2639         keep old "none" behavior for "stack".
2640         * rendering/style/RenderStyle.h: Add new helper methods to know the
2641         direction and algorithm of grid-auto-flow property.
2642         * rendering/style/RenderStyleConstants.h: Redefine GridAutoFlow enum
2643         using flags for algorithm and direction.
2644         * rendering/style/StyleGridData.h: Change m_gridAutoFlow type to
2645         unsigned.
2646
2647 2014-07-10  Myles C. Maxfield  <mmaxfield@apple.com>
2648
2649         [iOS] Pasting rich content does not perform a two-step paste
2650         https://bugs.webkit.org/show_bug.cgi?id=134795
2651
2652         Reviewed by Benjamin Poulain.
2653
2654         UIKit requires writing something (anything!) to a particular pasteboard
2655         during copy in order to flag the content as rich. When a paste occurs,
2656         UIKit will read this flag and perform a two-step paste.
2657
2658         Test: platform/ios-sim/editing/pasteboard/two-step-paste.html
2659
2660         * platform/ios/PlatformPasteboardIOS.mm:
2661         (WebCore::PlatformPasteboard::write):
2662
2663 2014-07-09  Andy Estes  <aestes@apple.com>
2664
2665         [iOS] Some QuickLook documents are not displayed as previews
2666         https://bugs.webkit.org/show_bug.cgi?id=134788
2667         <rdar://problem/17278194>
2668
2669         Reviewed by Pratik Solanki.
2670
2671         ResourceRequest::isMainResourceRequest() is not reliable (e.g. ResourceRequests reconstituted from an
2672         NSURLRequest have no way to set this bit properly) and should probably be removed. Instead of using
2673         isMainResourceRequest() to check if a QuickLookHandle should be created when the Network Process is in use,
2674         just check if the current ResourceLoader is the same as the DocumentLoader's ResourceLoader.
2675
2676         No new tests. QuickLook is not testable from WebKit.
2677
2678         * platform/network/ios/QuickLook.mm:
2679         (WebCore::QuickLookHandle::create):
2680
2681 2014-07-10  Andreas Kling  <akling@apple.com>
2682
2683         [iOS WebKit2] Don't uninstall the memory pressure listener after first signal.
2684         <https://webkit.org/b/134814>
2685
2686         The call to uninstall() should not be made on iOS since iOS doesn't use the
2687         hold-off mechanism in MemoryPressureHandler.
2688
2689         Reviewed by Benjamin Poulain.
2690
2691         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2692         (WebCore::MemoryPressureHandler::respondToMemoryPressure):
2693
2694 2014-07-10  Jer Noble  <jer.noble@apple.com>
2695
2696         [MSE] Overlapping appended ranges must cause the decoder to flush and re-enqueue.
2697         https://bugs.webkit.org/show_bug.cgi?id=134805
2698
2699         Reviewed by Eric Carlson.
2700
2701         When appending a range of media data which overlaps with an existing range, SourceBuffer
2702         must cause the decoder to flush and re-enqueue samples. Those samples removed by appending
2703         the overlapping range may have already been enqueued for display, and unless the decode
2704         queue is flushed, corruption or decode errors may occur as the new samples are enqueued for
2705         display.
2706
2707         Add a boolean flag onto TrackBuffer to indicate whether the decoder needs to be flushed and
2708         re-enqueued the next time an append operation completes. Set this flag whenever samples are
2709         removed due to overlapping or an explicit call to removeCodedFrames(). Move the contents of
2710         sourceBufferPrivateSeekToTime() (which previously did flushing and re-enqueueing) into a new
2711         function, reenqueueMediaForTime(), which can be called from sourceBufferPrivateAppendComplete().
2712
2713         Drive-by fix: findSyncSampleAfterDecodeIterator() would return the passed in iterator if that
2714         sample is a sync-sample. Fix this to correctly return the next sync sample.
2715
2716         Drive-by fix: Use a SampleMap, rather than a DecodeOrderSampleMap, to track erased samples
2717         so that the erasedSamples are correctly accounted for in both presentation and decode orders.
2718
2719         * Modules/mediasource/SampleMap.cpp:
2720         (WebCore::SampleMap::empty): Add convenience method.
2721         (WebCore::DecodeOrderSampleMap::findSyncSampleAfterDecodeIterator): Drive-by fix.
2722         * Modules/mediasource/SampleMap.h:
2723         (WebCore::SampleMap::decodeOrder): Added const accessor.
2724         (WebCore::SampleMap::presentationOrder): Ditto.
2725         (WebCore::SampleMap::addRange): Added.
2726         * Modules/mediasource/SourceBuffer.cpp:
2727         (WebCore::SourceBuffer::TrackBuffer::TrackBuffer): Add needsReenqueeing flag.
2728         (WebCore::SourceBuffer::sourceBufferPrivateSeekToTime): Move contents into reenqueueMediaForTime().
2729         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Call reenqueMediaForTime() if necessary.
2730         (WebCore::SourceBuffer::removeCodedFrames): Set needsReenqueing.
2731         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
2732         (WebCore::SourceBuffer::provideMediaData): Drive-by fix.
2733         (WebCore::SourceBuffer::reenqueueMediaForTime): Moved from sourceBufferPrivateSeekToTime().
2734         * Modules/mediasource/SourceBuffer.h:
2735
2736 2014-07-10  Pratik Solanki  <psolanki@apple.com>
2737
2738         ASSERT in SharedBuffer::maybeAppendDataArray() on MobileSafari launch
2739         https://bugs.webkit.org/show_bug.cgi?id=134812
2740         <rdar://problem/17628434>
2741
2742         Reviewed by Joseph Pecoraro.
2743
2744         Fix bug in my fix in r170930. Initialize the badly named m_shouldUsePurgeableMemory field to
2745         false. This field indicates when it is okay to use purgeable memory and is set to true once
2746         the resource is finished loading. By setting it to true in the constructor we were creating
2747         purgeable memory while the resource was still being loaded and this triggered the assert.
2748
2749         No new tests. Should be covered by existing tests.
2750
2751         * platform/cf/SharedBufferCF.cpp:
2752         (WebCore::SharedBuffer::SharedBuffer):
2753
2754 2014-07-10  Andreas Kling  <akling@apple.com>
2755
2756         [iOS WebKit2] Some memory pressure relief tweaks.
2757         <https://webkit.org/b/134811>
2758
2759         Split memory pressure relief into critical and non-critical sections.
2760         Non-critical relief is for clearing out things that are really not
2761         essential, e.g unused font data, text measurement caches, etc.
2762
2763         On iOS, only flip the "WebKit is under memory pressure" flag when we
2764         are under *critical* memroy pressure, rather than doing it early on
2765         and gimping ourselves because other processes are too big.
2766
2767         Also added logging for when we transition in/out of system pressure.
2768
2769         Reviewed by Geoffrey Garen.
2770
2771         * platform/MemoryPressureHandler.cpp:
2772         (WebCore::MemoryPressureHandler::releaseNoncriticalMemory):
2773         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
2774         (WebCore::MemoryPressureHandler::releaseMemory):
2775         * platform/MemoryPressureHandler.h:
2776         (WebCore::MemoryPressureHandler::ReliefLogger::loggingEnabled):
2777         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2778         (WebCore::MemoryPressureHandler::install):
2779
2780 2014-07-10  Beth Dakin  <bdakin@apple.com>
2781
2782         Need Setting/WKPreference that allows clients to prevent scrollbars from drawing 
2783         on a secondary thread
2784         https://bugs.webkit.org/show_bug.cgi?id=134778
2785         -and corresponding-
2786         <rdar://problem/17595333>
2787
2788         Reviewed by Tim Horton.
2789
2790         This is a requirement for some types of performance tests. The patch adds a new 
2791         virtual function to ScrollableArea that forces subclasses to indicate the value of 
2792         the Setting. This is required because Scrollbar and ScrollableArea can’t get to 
2793         Settings on their own.
2794
2795         * page/FrameView.cpp:
2796         (WebCore::FrameView::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
2797         * page/FrameView.h:
2798         * page/Settings.in:
2799         * platform/ScrollableArea.h:
2800         * platform/Scrollbar.cpp:
2801         (WebCore::Scrollbar::supportsUpdateOnSecondaryThread):
2802         * platform/win/PopupMenuWin.h:
2803         * rendering/RenderLayer.cpp:
2804         (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
2805         * rendering/RenderLayer.h:
2806         * rendering/RenderListBox.cpp:
2807         (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
2808         * rendering/RenderListBox.h:
2809
2810 2014-07-10  Brady Eidson  <beidson@apple.com>
2811
2812         Phone number highlights should always be visible if the mouse hovers over.
2813         <rdar://problem/17527476> and https://bugs.webkit.org/show_bug.cgi?id=134784
2814
2815         Reviewed by Tim Horton.
2816
2817         * WebCore.exp.in:
2818
2819 2014-07-10  Timothy Horton  <timothy_horton@apple.com>
2820
2821         Assertions or crashes under _takeViewSnapshot when restoring windows
2822         https://bugs.webkit.org/show_bug.cgi?id=134792
2823
2824         Reviewed by Simon Fraser.
2825
2826         * platform/graphics/cocoa/IOSurface.mm:
2827         (IOSurface::createFromImage):
2828
2829 2014-07-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2830
2831         [XHR] overrideMimeType() should be able to change encoding in HEADERS RECEIVED state
2832         https://bugs.webkit.org/show_bug.cgi?id=128968
2833
2834         Reviewed by Alexey Proskuryakov.
2835
2836         Moved response encoding computation from didReceiveResponse to didReceiveData, just before the decoder is instantiated.
2837         This allows overrideMimeType to be changed within readystatechange event callback and have an impact on selected encoding.
2838
2839         Test: http/tests/xmlhttprequest/overridemimetype-headers-received-state-force-shiftjis.html
2840
2841         * xml/XMLHttpRequest.cpp:
2842         (WebCore::XMLHttpRequest::didReceiveResponse): Removed m_responseEncoding computation from response and mimeTypeOverride.
2843         (WebCore::XMLHttpRequest::didReceiveData): Added m_responseEncoding computation from response and mimeTypeOverride.
2844
2845 2014-07-09  Brady Eidson  <beidson@apple.com>
2846
2847         Fire connected/disconnected events for Gamepads.
2848         https://bugs.webkit.org/show_bug.cgi?id=134386
2849
2850         Reviewed by Dean Jackson.
2851
2852         No new tests (No effect in a currently tested config)
2853
2854         * Modules/gamepad/GamepadManager.cpp:
2855         (WebCore::navigatorGamepadFromDOMWindow): Handling converting a possibly-null Navigator into
2856             a possibly null NavigatorGamepad.
2857         (WebCore::GamepadManager::platformGamepadConnected): Notify blind Navigator/DOMWindows of all
2858             previously attached Gamepads, then notify everybody of this new gamepad.
2859         (WebCore::GamepadManager::platformGamepadDisconnected): Handle dispatching the disconnected
2860             event to all registered DOMWindows.
2861         (WebCore::GamepadManager::platformGamepadInputActivity): Notify blind Navigator/DOMWindows of all
2862             attached Gamepads.
2863         (WebCore::GamepadManager::makeGamepadVisible): Handles notifying setting up a new gamepads
2864             with all NavigatorGamepads as well as dispatching the connected even to DOMWindows.
2865         (WebCore::GamepadManager::registerDOMWindow):
2866         (WebCore::GamepadManager::unregisterDOMWindow):
2867         (WebCore::GamepadManager::makeGamepadsVisibileToBlindNavigators): Deleted.
2868         * Modules/gamepad/GamepadManager.h:
2869
2870         * Modules/gamepad/NavigatorGamepad.cpp:
2871         (WebCore::NavigatorGamepad::gamepadAtIndex):
2872         * Modules/gamepad/NavigatorGamepad.h:
2873
2874 2014-07-09  Benjamin Poulain  <bpoulain@apple.com>
2875
2876         [iOS][WK2] Disable text quantization while actively changing the page's scale factor
2877         https://bugs.webkit.org/show_bug.cgi?id=134781
2878
2879         Reviewed by Tim Horton and Myles C. Maxfield.
2880
2881         Query the chrome client to setup quantization on each layers.
2882
2883         * page/ChromeClient.h:
2884         (WebCore::ChromeClient::hasStablePageScaleFactor):
2885         * platform/graphics/mac/FontMac.mm:
2886         (WebCore::Font::drawGlyphs):
2887         * rendering/RenderLayer.cpp:
2888         (WebCore::RenderLayer::setupFontSubpixelQuantization):
2889
2890 2014-07-09  peavo@outlook.com  <peavo@outlook.com>
2891
2892         [Curl] Cache entry invalidated too early.
2893         https://bugs.webkit.org/show_bug.cgi?id=134681
2894
2895         Reviewed by Alex Christensen.
2896
2897         When a cache entry has expired, it is invalidated when a request for the corresponding url is started.
2898         This is too early, since the resource is possibly not modified (even though it has expired),
2899         and the server might respond with a 304 (not modified) response.
2900         When we then receive a 304 response, the cache entry is deleted, and we have no cached response/data to provide.
2901         This can be solved by not invalidating the entry when a request for that url is started,
2902         but instead invalidate when a 200 OK response is received (which means the resource has been modified).
2903
2904         * platform/network/curl/CurlCacheManager.cpp:
2905         (WebCore::CurlCacheManager::isCached): Avoid invalidating cache entry when it has expired, wait until we know the server response.
2906         * platform/network/curl/CurlCacheManager.h: Added const modifier.
2907
2908 2014-07-09  Myles C. Maxfield  <mmaxfield@apple.com>
2909
2910         Revert r170413 and r170390
2911         https://bugs.webkit.org/show_bug.cgi?id=134741
2912
2913         Reviewed by Benjamin Poulain.
2914
2915         These patches caused a variety of failures. I'm going to break them up into
2916         smaller chunks and commit them separately at some point in the future.
2917
2918         Requesting a review from Ben Poulain because there were some conflicts with
2919         r170561 in InlineTextBox.cpp and InlineTextBox.h.
2920
2921         * WebCore.exp.in:
2922         * platform/graphics/Font.cpp:
2923         (WebCore::Font::drawText):
2924         (WebCore::Font::drawEmphasisMarks):
2925         (WebCore::Font::adjustSelectionRectForText):
2926         (WebCore::computeUnderlineType):
2927         * platform/graphics/Font.h:
2928         * platform/graphics/FontFastPath.cpp:
2929         (WebCore::Font::getGlyphsAndAdvancesForSimpleText):
2930         (WebCore::Font::drawSimpleText):
2931         (WebCore::Font::drawEmphasisMarksForSimpleText):
2932         (WebCore::Font::drawGlyphBuffer):
2933         (WebCore::Font::drawEmphasisMarks):
2934         (WebCore::Font::adjustSelectionRectForSimpleText):
2935         * platform/graphics/GlyphBuffer.h:
2936         (WebCore::GlyphBuffer::size):
2937         (WebCore::GlyphBuffer::glyphs):
2938         (WebCore::GlyphBuffer::advances):
2939         (WebCore::GlyphBuffer::fontDataAt):
2940         (WebCore::GlyphBuffer::advanceAt):
2941         (WebCore::GlyphBuffer::offsetAt):
2942         (WebCore::GlyphBuffer::reverse):
2943         (WebCore::GlyphBuffer::offsetInString):
2944         (WebCore::GlyphBuffer::swap):
2945         * platform/graphics/GraphicsContext.cpp:
2946         * platform/graphics/Latin1TextIterator.h:
2947         (WebCore::Latin1TextIterator::Latin1TextIterator):
2948         (WebCore::Latin1TextIterator::currentCharacter):
2949         * platform/graphics/SimpleFontData.h:
2950         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
2951         (WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
2952         * platform/graphics/SurrogatePairAwareTextIterator.h:
2953         (WebCore::SurrogatePairAwareTextIterator::currentCharacter):
2954         * platform/graphics/TextRun.h:
2955         (WebCore::TextRun::length):
2956         (WebCore::TextRun::charactersLength):
2957         * platform/graphics/WidthIterator.cpp:
2958         (WebCore::WidthIterator::glyphDataForCharacter):
2959         (WebCore::applyFontTransforms):
2960         (WebCore::WidthIterator::advanceInternal):
2961         (WebCore::WidthIterator::advance):
2962         (WebCore::WidthIterator::advanceOneCharacter):
2963         * platform/graphics/WidthIterator.h:
2964         * platform/graphics/cairo/FontCairo.cpp:
2965         (WebCore::Font::drawGlyphs):
2966         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2967         (WebCore::Font::drawComplexText):
2968         (WebCore::Font::drawEmphasisMarksForComplexText):
2969         (WebCore::Font::adjustSelectionRectForComplexText):
2970         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2971         (WebCore::HarfBuzzShaper::setNormalizedBuffer):
2972         * platform/graphics/mac/FontComplexTextMac.cpp:
2973         (WebCore::Font::adjustSelectionRectForComplexText):
2974         (WebCore::Font::getGlyphsAndAdvancesForComplexText):
2975         (WebCore::Font::drawComplexText):
2976         (WebCore::Font::drawEmphasisMarksForComplexText):
2977         * platform/graphics/mac/FontMac.mm:
2978         (WebCore::Font::drawGlyphs):
2979         * platform/graphics/win/FontCGWin.cpp:
2980         (WebCore::Font::drawGlyphs):
2981         * platform/graphics/win/FontWin.cpp:
2982         (WebCore::Font::adjustSelectionRectForComplexText):
2983         (WebCore::Font::getGlyphsAndAdvancesForComplexText):
2984         (WebCore::Font::drawComplexText):
2985         (WebCore::Font::drawEmphasisMarksForComplexText):
2986         * platform/graphics/wince/FontWinCE.cpp:
2987         (WebCore::Font::drawGlyphs):
2988         (WebCore::Font::drawComplexText):
2989         (WebCore::Font::drawEmphasisMarksForComplexText):
2990         (WebCore::Font::selectionRectForComplexText):
2991         * rendering/InlineTextBox.cpp:
2992         (WebCore::InlineTextBox::isSelected):
2993         (WebCore::InlineTextBox::selectionState):
2994         (WebCore::InlineTextBox::localSelectionRect):
2995         (WebCore::InlineTextBox::paint):
2996         (WebCore::InlineTextBox::selectionStartEnd):
2997         (WebCore::InlineTextBox::paintSelection):
2998         (WebCore::InlineTextBox::paintCompositionBackground):
2999         (WebCore::InlineTextBox::paintDocumentMarker):
3000         (WebCore::InlineTextBox::paintTextMatchMarker):
3001         (WebCore::InlineTextBox::computeRectForReplacementMarker):
3002         (WebCore::InlineTextBox::paintCompositionUnderline):
3003         (WebCore::InlineTextBox::positionForOffset):
3004         (WebCore::InlineTextBox::constructTextRun):
3005         * rendering/InlineTextBox.h:
3006         (WebCore::InlineTextBox::truncation):
3007         * rendering/RenderCombineText.cpp:
3008         (WebCore::RenderCombineText::getStringToRender):
3009         * rendering/RenderCombineText.h:
3010         * rendering/RenderTextLineBoxes.cpp:
3011         (WebCore::ellipsisRectForBox):
3012         * rendering/svg/SVGInlineFlowBox.cpp:
3013         (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
3014         * rendering/svg/SVGInlineTextBox.cpp:
3015         (WebCore::SVGInlineTextBox::positionForOffset):
3016         (WebCore::SVGInlineTextBox::localSelectionRect):
3017         (WebCore::SVGInlineTextBox::paintSelectionBackground):
3018         (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates):
3019         (WebCore::SVGInlineTextBox::paintText):
3020         * rendering/svg/SVGInlineTextBox.h:
3021         * rendering/svg/SVGTextMetricsBuilder.cpp:
3022         (WebCore::SVGTextMetricsBuilder::currentCharacterStartsSurrogatePair):
3023         (WebCore::SVGTextMetricsBuilder::advance):
3024         * rendering/svg/SVGTextQuery.cpp:
3025         (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates):
3026         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures):
3027         (WebCore::SVGTextQuery::subStringLengthCallback):
3028         (WebCore::SVGTextQuery::startPositionOfCharacterCallback):
3029         (WebCore::SVGTextQuery::endPositionOfCharacterCallback):
3030         (WebCore::SVGTextQuery::rotationOfCharacterCallback):
3031         (WebCore::SVGTextQuery::extentOfCharacterCallback):
3032         (WebCore::SVGTextQuery::characterNumberAtPositionCallback):
3033         * rendering/svg/SVGTextQuery.h:
3034         * rendering/svg/SVGTextRunRenderingContext.cpp:
3035         (WebCore::SVGGlyphToPathTranslator::SVGGlyphToPathTranslator):
3036         (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter):
3037         * rendering/svg/SVGTextRunRenderingContext.h:
3038         * svg/SVGFontData.cpp:
3039         (WebCore::SVGFontData::applySVGGlyphSelection):
3040         * svg/SVGFontData.h:
3041
3042 2014-07-08  Jeffrey Pfau  <jpfau@apple.com>
3043
3044         Fix flaky loading tests
3045         https://bugs.webkit.org/show_bug.cgi?id=133696
3046
3047         Reviewed by Ryosuke Niwa.
3048
3049         In some cases, the Frame may be destroyed while the loader is
3050         initializing. Make sure we don't delete it too early.
3051
3052         * loader/FrameLoader.cpp:
3053         (WebCore::FrameLoader::init):
3054
3055 2014-07-09  Simon Fraser  <simon.fraser@apple.com>
3056
3057         Make IndirectCompositingReason an enum class
3058         https://bugs.webkit.org/show_bug.cgi?id=134789
3059
3060         Reviewed by Tim Horton.
3061
3062         Make RenderLayer::IndirectCompositingReason an enum class, and change some code
3063         in RenderLayerCompositor::reasonsForCompositing() to use a switch.
3064
3065         * rendering/RenderLayer.cpp:
3066         (WebCore::RenderLayer::RenderLayer):
3067         * rendering/RenderLayer.h:
3068         * rendering/RenderLayerCompositor.cpp:
3069         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3070         (WebCore::RenderLayerCompositor::requiresOwnBackingStore):
3071         (WebCore::RenderLayerCompositor::reasonsForCompositing):
3072         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason):
3073
3074 2014-07-09  Pratik Solanki  <psolanki@apple.com>
3075
3076         Make SharedBuffer::append(SharedBuffer*) be smarter about CFData and data arrays
3077         https://bugs.webkit.org/show_bug.cgi?id=134731
3078
3079         Reviewed by Antti Koivisto.
3080
3081         If the target SharedBuffer has a CFDataRef or a data array then we can simply retain that
3082         CFDataRef or data array elements in the SharedBuffer being appended to. This avoids
3083         unnecessary copying.
3084
3085         No new tests because no functional changes.
3086
3087         * platform/SharedBuffer.cpp:
3088         (WebCore::SharedBuffer::append):
3089         (WebCore::SharedBuffer::maybeAppendPlatformData):
3090         * platform/SharedBuffer.h:
3091         * platform/cf/SharedBufferCF.cpp:
3092         (WebCore::SharedBuffer::maybeAppendPlatformData):
3093         (WebCore::SharedBuffer::maybeAppendDataArray):
3094         * platform/soup/SharedBufferSoup.cpp:
3095         (WebCore::SharedBuffer::maybeAppendPlatformData):
3096
3097 2014-07-09  Brent Fulgham  <bfulgham@apple.com>
3098
3099         [Win] Remove uses of 'bash' in build system
3100         https://bugs.webkit.org/show_bug.cgi?id=134782
3101         <rdar://problem/17615533>
3102
3103         Reviewed by Dean Jackson.
3104
3105         Remove uses of 'bash' by replacing Windows-specific bash scripts
3106         with Perl equivalents.
3107
3108         * WebCore.vcxproj/WebCoreGenerated.make:
3109         * WebCore.vcxproj/WebCoreGenerated.vcxproj:
3110         * WebCore.vcxproj/WebCoreGenerated.vcxproj.filters:
3111         * WebCore.vcxproj/WebCorePreBuild.cmd:
3112         * WebCore.vcxproj/build-generated-files.pl: Copied from Source/WebCore/WebCore.vcxproj/build-generated-files.sh.
3113         * WebCore.vcxproj/build-generated-files.sh: Removed.
3114         * WebCore.vcxproj/migrate-scripts.pl: Copied from Source/WebCore/WebCore.vcxproj/migrate-scripts.sh.
3115         * WebCore.vcxproj/migrate-scripts.sh: Removed.
3116
3117 2014-07-09  Anders Carlsson  <andersca@apple.com>
3118
3119         Support transparent WKWebViews
3120         https://bugs.webkit.org/show_bug.cgi?id=134779
3121         <rdar://problem/17351058>
3122
3123         Reviewed by Tim Horton.
3124
3125         Schedule rebuilding the compositing layers if a FrameView's transparency changes.
3126
3127         * page/FrameView.cpp:
3128         (WebCore::FrameView::setTransparent):
3129
3130 2014-07-09  Javier Fernandez  <jfernandez@igalia.com>
3131         CSS canvas color parsing accepts invalid color identifiers
3132         https://bugs.webkit.org/show_bug.cgi?id=134661
3133
3134         Reviewed by Benjamin Poulain.
3135
3136         Current implementation of the CSSParser::parseSystemColor assumes
3137         that if a valid cssValueKeywordID is got then it has to be a valid
3138         color. Such assumption is wrong and lead to many bugs and layout
3139         test failures.
3140
3141         The parseSystemFunction determines now whether the parsed color is
3142         valid or not.
3143
3144         Addtionally, a new method has been added to share the logic of
3145         determining whether a CSSValueID is a valid primitive values for
3146         colors or not. Generally, we should avoid passing invalid color
3147         identifiers to the theming API.
3148
3149         No new tests, but added additional cases to the
3150         canvas-color-serialization.html, test-setting-canvas-color and
3151         rgb-color-parse test.
3152
3153         * css/CSSParser.cpp:
3154         (WebCore::validPrimitiveValueColor): Added.
3155         (WebCore::parseColorValue):
3156         (WebCore::CSSParser::parseSystemColor):
3157
3158 2014-06-28  Jer Noble  <jer.noble@apple.com>
3159
3160         [MSE] http/tests/media/media-source/mediasource-remove.html is failing
3161         https://bugs.webkit.org/show_bug.cgi?id=134768
3162
3163         Reviewed by Eric Carlson.
3164
3165         Fix multiple bugs causing mediasource-remove.html to fail:
3166
3167         Separate out setDuration() into setDurationInternal() so that steps which require
3168         us to run the "duration change algorithm" don't bail out if the SoureBuffer is
3169         inside updating().
3170
3171         * Modules/mediasource/MediaSource.cpp:
3172         (WebCore::MediaSource::setDuration):
3173         (WebCore::MediaSource::setDurationInternal):
3174         * Modules/mediasource/MediaSource.h:
3175         * Modules/mediasource/SourceBuffer.cpp:
3176         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
3177         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3178
3179         When removing coded frames, do so starting from the first sample in the range in
3180         decode order, so that frames dependant on removed frames are themselves removed. Add
3181         a convenience method in SampleMap findSampleWithPresentationTime(), and rename
3182         findSampleAfterPresentationTime() to findSampleOnOrAfterPresentationTime() to correctly
3183         reflect what the method does, and simplify its implementation by searching the map's keys
3184         directly.
3185
3186         * Modules/mediasource/SampleMap.cpp:
3187         (WebCore::PresentationOrderSampleMap::findSampleWithPresentationTime):
3188         (WebCore::PresentationOrderSampleMap::findSampleOnOrAfterPresentationTime):
3189         (WebCore::DecodeOrderSampleMap::findSyncSampleAfterPresentationTime):
3190         (WebCore::PresentationOrderSampleMap::findSampleAfterPresentationTime): Deleted.
3191         * Modules/mediasource/SampleMap.h:
3192         * Modules/mediasource/SourceBuffer.cpp:
3193         (WebCore::decodeTimeComparator):
3194         (WebCore::SourceBuffer::removeCodedFrames):
3195
3196         Throw the correct exception (INVALID_STATE_ERR) from SourceBuffer::remove().
3197
3198         * Modules/mediasource/SourceBuffer.cpp:
3199         (WebCore::SourceBuffer::remove):
3200
3201 2014-07-09  Pratik Solanki  <psolanki@apple.com>
3202
3203         Add SharedBuffer::wrapCFDataArray() and use it
3204         https://bugs.webkit.org/show_bug.cgi?id=134733
3205
3206         Reviewed by Antti Koivisto.
3207
3208         No new tests. Should be covered by existing tests.
3209
3210         * platform/SharedBuffer.h:
3211         * platform/cf/SharedBufferCF.cpp:
3212         (WebCore::SharedBuffer::wrapCFDataArray):
3213         (WebCore::SharedBuffer::SharedBuffer):
3214         * platform/network/ResourceHandle.h:
3215         * platform/network/cf/ResourceHandleCFNet.cpp:
3216         (WebCore::ResourceHandle::handleDataArray): Deleted.
3217         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3218         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray):
3219         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
3220         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray):
3221         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3222         (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]):
3223         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3224         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveDataArray:]):
3225
3226 2014-07-09  Pratik Solanki  <psolanki@apple.com>
3227
3228         Move resource buffering from SynchronousNetworkLoaderClient to NetworkResourceLoader
3229         https://bugs.webkit.org/show_bug.cgi?id=134732
3230
3231         Reviewed by Darin Adler.
3232
3233         No new tests because no functional changes.
3234
3235         * WebCore.exp.in:
3236
3237 2014-07-09  Tim Horton  <timothy_horton@apple.com>
3238
3239         Fix the !USE(IOSURFACE) build.
3240
3241         * WebCore.exp.in:
3242
3243 2014-07-09  Tim Horton  <timothy_horton@apple.com>
3244
3245         Use IOSurface ViewSnapshots everywhere on Mac, remove JPEG encoding path
3246         https://bugs.webkit.org/show_bug.cgi?id=134773
3247
3248         Reviewed by Anders Carlsson.
3249
3250         * WebCore.exp.in:
3251         * platform/graphics/cocoa/IOSurface.h:
3252         * platform/graphics/cocoa/IOSurface.mm:
3253         (IOSurface::createFromImage):
3254         Move make-an-IOSurface-from-a-CGImageRef into WebCore::IOSurface.
3255
3256 2014-07-09  Enrica Casucci  <enrica@apple.com>
3257
3258         Implement Editor::fontAttributesForSelectionStart() or iOS.
3259         https://bugs.webkit.org/show_bug.cgi?id=134771
3260         <rdar://problem/16167838>
3261
3262         Reviewed by Ryosuke Niwa.
3263
3264         Implement for iOS the equivalent function we have for OS X.
3265
3266         * editing/ios/EditorIOS.mm:
3267         (WebCore::Editor::fontAttributesForSelectionStart):
3268
3269 2014-07-09  Brent Fulgham  <bfulgham@apple.com>
3270
3271         [Win] Remove use of 'grep' in build steps
3272         https://bugs.webkit.org/show_bug.cgi?id=134770
3273         <rdar://problem/17608783>
3274
3275         Reviewed by Tim Horton.
3276
3277         Replace uses of the grep command in Windows builds with the equivalent
3278         Perl program.
3279
3280         * WebCore.vcxproj/WebCoreGenerated.make:
3281         * WebCore.vcxproj/WebCorePreBuild.cmd:
3282         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
3283         (WebCore::WebCoreAVCFResourceLoader::notifyFinished):
3284
3285 2014-07-09  Alex Christensen  <achristensen@webkit.org>
3286
3287         Added css jit profiler, disabled by default.
3288         https://bugs.webkit.org/show_bug.cgi?id=134695
3289
3290         Reviewed by Benjamin Poulain.
3291
3292         * css/ElementRuleCollector.cpp:
3293         (WebCore::ElementRuleCollector::ruleMatches):
3294         Tell the RuleData when its compiled selector is used.
3295         * css/RuleSet.cpp:
3296         (WebCore::RuleData::RuleData):
3297         Initialize the compiled selector use count to 0.
3298         * css/RuleSet.h:
3299         (WebCore::RuleData::~RuleData):
3300         (WebCore::RuleData::compiledSelectorUsed):
3301         Count and log the number of times a compiled selector is used.
3302         * cssjit/SelectorCompiler.h:
3303         Added option for CSS_SELECTOR_JIT_PROFILING set to 0 by default.
3304         * dom/SelectorQuery.cpp:
3305         (WebCore::SelectorDataList::executeCompiledSimpleSelectorChecker):
3306         (WebCore::SelectorDataList::execute):
3307         Tell the SelectorData when its compiled selector is used.
3308         * dom/SelectorQuery.h:
3309         (WebCore::SelectorDataList::SelectorData::SelectorData):
3310         (WebCore::SelectorDataList::SelectorData::~SelectorData):
3311         (WebCore::SelectorDataList::SelectorData::compiledSelectorUsed):
3312         Count and log the number of times a compiled selector is used.
3313
3314 2014-07-09  Eric Carlson  <eric.carlson@apple.com>
3315
3316         [iOS] caption size is sometimes incorrect in fullscreen
3317         https://bugs.webkit.org/show_bug.cgi?id=134740
3318
3319         Reviewed by Jer Noble.
3320
3321         Captions on iOS are displayed in fullscreen with a TextTrackRepresentation object. Because
3322         the fullscreen video presentation is controlled by code in the UI process running on the
3323         UI thread, WebCore is notified of changes to fullscreen state asynchronously. This resulted
3324         in the TextTrackRepresentation object being created and/or destroyed too late some of the 
3325         time, which caused us to sometimes display captions incorrectly. Fix this by setting up and
3326         tearing down the TextTrackRepresentation object when WebCore's 'webkitfullscreenchange'
3327         event fires.
3328
3329         * Modules/mediacontrols/MediaControlsHost.cpp:
3330         (WebCore::MediaControlsHost::enteredFullscreen): Notify text track container.
3331         (WebCore::MediaControlsHost::exitedFullscreen): Ditto.
3332         * Modules/mediacontrols/MediaControlsHost.h:
3333         * Modules/mediacontrols/MediaControlsHost.idl:
3334
3335         * Modules/mediacontrols/mediaControlsApple.js:
3336         (Controller.prototype.handleFullscreenChange): Notify host of fullscreen change.
3337
3338         * html/HTMLMediaElement.cpp:
3339         (WebCore::HTMLMediaElement::requiresTextTrackRepresentation): Only return true when in
3340             fullscreen.
3341         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Call updateTextTrackDisplay.
3342
3343         * html/shadow/MediaControlElements.cpp:
3344         (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize
3345             m_updateTextTrackRepresentationStyle to false.
3346         (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Move logic for creating
3347             TextTrackRepresentation to updateTextTrackRepresentation.
3348         (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize): New, split out of updateTimerFired.
3349         (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Move code to force immediate
3350             font size change to updateActiveCuesFontSize.
3351         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): New, update
3352             text track representation, creating first if necessary.
3353         (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): Add an early
3354             return if we don't have a text track representation.
3355         (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Early
3356             return if there is nothing to be done.
3357         (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): Force a caption update
3358             if there are visible captions.
3359         (WebCore::MediaControlTextTrackContainerElement::updateSizes): Set m_updateTextTrackRepresentationStyle
3360             to true.
3361         (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged):  Force a 
3362             caption update if there are visible captions.
3363         * html/shadow/MediaControlElements.h:
3364
3365 2014-07-09  Jer Noble  <jer.noble@apple.com>
3366
3367         [MSE] http/tests/media/media-source/mediasource-endofstream-invaliderror.html is failing.
3368         https://bugs.webkit.org/show_bug.cgi?id=134413
3369
3370         Reviewed by Eric Carlson.
3371
3372         Update MediaSource.endOfStream() to take an optional enum instead of an optional String.
3373
3374         * Modules/mediasource/MediaSource.cpp:
3375         (WebCore::MediaSource::endOfStream):
3376         * Modules/mediasource/MediaSource.h:
3377         * Modules/mediasource/MediaSource.idl:
3378
3379 2014-07-08  Brady Eidson  <beidson@apple.com>
3380
3381         DOMWindows should register themselves with the GamepadManager when they have event listeners
3382         https://bugs.webkit.org/show_bug.cgi?id=134669
3383
3384         Reviewed by Dean Jackson.
3385
3386         No new tests (No effect in a currently tested config)
3387
3388         By having DOMWindows register with the GamepadManager when they have/don’t have gamepad event
3389         listeners, we accomplish two things:
3390         1 - It’s simple for GamepadManager to dispatch gamepad events directly to the DOMWindows interested.
3391         2 - We know when to start monitoring for gamepad connections.
3392
3393         * Modules/gamepad/GamepadManager.cpp:
3394         (WebCore::GamepadManager::GamepadManager):
3395         (WebCore::GamepadManager::registerNavigator):
3396         (WebCore::GamepadManager::unregisterNavigator):
3397         (WebCore::GamepadManager::registerDOMWindow):
3398         (WebCore::GamepadManager::unregisterDOMWindow):
3399         (WebCore::GamepadManager::maybeStartMonitoringGamepads): Start monitoring gamepads if there are any
3400           registered DOMWindows or NavigatorGamepads, and we aren’t already monitoring them.
3401         (WebCore::GamepadManager::maybeStopMonitoringGamepads): Stop monitoring gamepads if there aren’t any
3402           registered DOMWindows or NavigatorGameads, and we have been monitoring them before now.