Have Document::accessSVGExtensions() return a reference
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2014-09-23  Chris Dumez  <cdumez@apple.com>
2
3         Have Document::accessSVGExtensions() return a reference
4         https://bugs.webkit.org/show_bug.cgi?id=137030
5
6         Reviewed by Ryosuke Niwa.
7
8         Have Document::accessSVGExtensions() return a reference instead of a
9         pointer as it can never return null.
10
11         No new tests, no behavior change.
12
13         * dom/ContainerNode.cpp:
14         (WebCore::ContainerNode::removeChild):
15         (WebCore::ContainerNode::removeChildren):
16         * dom/Document.cpp:
17         (WebCore::Document::commonTeardown):
18         (WebCore::Document::implicitClose):
19         (WebCore::Document::accessSVGExtensions):
20         * dom/Document.h:
21         * dom/Element.cpp:
22         (WebCore::Element::~Element):
23         (WebCore::Element::removedFrom):
24         * editing/markup.cpp:
25         (WebCore::isPlainTextMarkup):
26         * history/CachedFrame.cpp:
27         (WebCore::CachedFrameBase::restore):
28         * rendering/FilterEffectRenderer.cpp:
29         (WebCore::FilterEffectRenderer::buildReferenceFilter):
30         * rendering/svg/RenderSVGResource.cpp:
31         (WebCore::removeFromCacheAndInvalidateDependencies):
32         * rendering/svg/RenderSVGResourceContainer.cpp:
33         (WebCore::svgExtensionsFromElement):
34         * rendering/svg/RenderSVGResourceContainer.h:
35         (WebCore::getRenderSVGResourceContainerById):
36         (WebCore::getRenderSVGResourceById):
37         * rendering/svg/SVGResources.cpp:
38         (WebCore::registerPendingResource):
39         (WebCore::SVGResources::buildCachedResources):
40         * rendering/svg/SVGResourcesCache.cpp:
41         (WebCore::resourcesCacheFromRenderer):
42         (WebCore::SVGResourcesCache::resourceDestroyed):
43         * svg/SVGElement.cpp:
44         (WebCore::SVGElement::~SVGElement):
45         (WebCore::SVGElement::reportAttributeParsingError):
46         (WebCore::SVGElement::removedFrom):
47         (WebCore::SVGElement::viewportElement):
48         (WebCore::SVGElement::attributeChanged):
49         (WebCore::SVGElement::buildPendingResourcesIfNeeded):
50         (WebCore::SVGElement::accessDocumentSVGExtensions): Deleted.
51         * svg/SVGElement.h:
52         * svg/SVGFEConvolveMatrixElement.cpp:
53         (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
54         * svg/SVGFEGaussianBlurElement.cpp:
55         (WebCore::SVGFEGaussianBlurElement::parseAttribute):
56         * svg/SVGFEImageElement.cpp:
57         (WebCore::SVGFEImageElement::clearResourceReferences):
58         (WebCore::SVGFEImageElement::buildPendingResource):
59         * svg/SVGFitToViewBox.cpp:
60         (WebCore::SVGFitToViewBox::parseViewBox):
61         * svg/SVGFontFaceElement.cpp:
62         (WebCore::SVGFontFaceElement::insertedInto):
63         (WebCore::SVGFontFaceElement::removedFrom):
64         * svg/SVGMPathElement.cpp:
65         (WebCore::SVGMPathElement::buildPendingResource):
66         (WebCore::SVGMPathElement::clearResourceReferences):
67         * svg/SVGPathElement.cpp:
68         (WebCore::SVGPathElement::parseAttribute):
69         (WebCore::SVGPathElement::invalidateMPathDependencies):
70         * svg/SVGPolyElement.cpp:
71         (WebCore::SVGPolyElement::parseAttribute):
72         * svg/SVGSVGElement.cpp:
73         (WebCore::SVGSVGElement::~SVGSVGElement):
74         (WebCore::SVGSVGElement::insertedInto):
75         (WebCore::SVGSVGElement::removedFrom):
76         * svg/SVGTRefElement.cpp:
77         (WebCore::SVGTRefElement::detachTarget):
78         (WebCore::SVGTRefElement::buildPendingResource):
79         * svg/SVGTextPathElement.cpp:
80         (WebCore::SVGTextPathElement::clearResourceReferences):
81         (WebCore::SVGTextPathElement::buildPendingResource):
82         * svg/SVGUseElement.cpp:
83         (WebCore::SVGUseElement::clearResourceReferences):
84         (WebCore::SVGUseElement::buildPendingResource):
85         (WebCore::SVGUseElement::toClipPath):
86         (WebCore::SVGUseElement::buildInstanceTree):
87         * svg/animation/SVGSMILElement.cpp:
88         (WebCore::SVGSMILElement::clearResourceReferences):
89         (WebCore::SVGSMILElement::buildPendingResource):
90
91 2014-09-23  Joseph Pecoraro  <pecoraro@apple.com>
92
93         Web Inspector: Should be able to attach a debugger to a JSContext before anything is executed
94         https://bugs.webkit.org/show_bug.cgi?id=136893
95
96         Reviewed by Timothy Hatcher.
97
98         Automatic inspection is currently disabled for web pages.
99         This just updates the interfaces that changed.
100
101         * WebCore.exp.in:
102         * inspector/InspectorController.cpp:
103         (WebCore::InspectorController::connectFrontend):
104         (WebCore::InspectorController::show):
105         * inspector/InspectorController.h:
106         * page/PageDebuggable.cpp:
107         (WebCore::PageDebuggable::connect):
108         * page/PageDebuggable.h:
109         * testing/Internals.cpp:
110         (WebCore::Internals::openDummyInspectorFrontend):
111
112 2014-09-23  Eduardo Lima Mitev  <elima@igalia.com>
113
114         [GTK] Adds implementation of subtle crypto HMAC algorithm
115         https://bugs.webkit.org/show_bug.cgi?id=133320
116
117         Reviewed by Philippe Normand.
118
119         Tests are already in place under crypto/subtle/hmac-*.html
120
121         * crypto/gtk/CryptoAlgorithmHMACGtk.cpp:
122         (WebCore::getGnutlsDigestAlgorithm):
123         (WebCore::calculateSignature):
124         (WebCore::CryptoAlgorithmHMAC::platformSign):
125         (WebCore::CryptoAlgorithmHMAC::platformVerify):
126
127 2014-09-23  Eduardo Lima Mitev  <elima@igalia.com>
128
129         [GTK] Adds implementation of Subtle Crypto digest algorithms
130         https://bugs.webkit.org/show_bug.cgi?id=133319
131
132         Reviewed by Philippe Normand.
133
134         Tests are already in place under crypto/subtle/sha-*.html
135
136         * crypto/gtk/CryptoDigestGtk.cpp:
137         (WebCore::CryptoDigest::CryptoDigest):
138         (WebCore::CryptoDigest::~CryptoDigest):
139         (WebCore::CryptoDigest::create):
140         (WebCore::CryptoDigest::addBytes):
141         (WebCore::CryptoDigest::computeHash):
142
143 2014-09-15  Sergio Villar Senin  <svillar@igalia.com>
144
145         [CSS Grid Layout] Do not grow tracks when the growth factor is 0
146         https://bugs.webkit.org/show_bug.cgi?id=136575
147
148         Reviewed by Darin Adler.
149
150         A couple of performance optimizations for the track sizing
151         algorithm. On the one hand we avoid the computation of the
152         available logical space share if the track has no growth potential
153         (the current breadth is the maximum breadth) and on the other
154         hand, we avoid calling RenderGrid::distributeSpaceToTracks() if
155         the available logical space is not greater than 0.
156
157         The combined effect of these two changes is an impressive +16%
158         improvement in auto-grid-lots-of-data.html performance test.
159
160         No new tests as there is no change in the functionality.
161
162         * rendering/RenderGrid.cpp:
163         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
164         (WebCore::RenderGrid::distributeSpaceToTracks):
165
166 2014-09-23  Ion Rosca  <rosca@adobe.com>
167
168         [CSS Blending] The composited layers isolated by the page group should blend with the default white background color.
169         https://bugs.webkit.org/show_bug.cgi?id=136563
170
171         Reviewed by Simon Fraser.
172
173         If a blending layer is not isolated, then it should blend with a white backdrop:
174         http://dev.w3.org/fxtf/compositing-1/#pagebackdrop
175
176         Tests: css3/blending/blend-mode-body-composited-child-background-color.html
177                css3/blending/blend-mode-body-composited-child.html
178
179         * rendering/RenderLayerBacking.cpp:
180         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
181         If the isolating composited layer is the root renderer, then it should have a backing store
182         into which the initial white backdrop will be painted.
183
184 2014-09-22  Christophe Dumez  <cdumez@apple.com>
185
186         Unreviewed build fix after r173859.
187
188         Partial revert to fix debug build after r173859.
189
190         * accessibility/AccessibilityRenderObject.cpp:
191         (WebCore::AccessibilityRenderObject::remoteSVGRootElement):
192         * html/HTMLFrameOwnerElement.cpp:
193         (WebCore::HTMLFrameOwnerElement::getSVGDocument):
194         * page/EventHandler.cpp:
195         (WebCore::EventHandler::handleMousePressEvent):
196         (WebCore::EventHandler::handleMouseMoveEvent):
197         (WebCore::EventHandler::handleMouseReleaseEvent):
198         * page/Frame.cpp:
199         (WebCore::Frame::setPageAndTextZoomFactors):
200         * page/FrameView.cpp:
201         (WebCore::FrameView::scrollToAnchor):
202         * rendering/svg/RenderSVGBlock.h:
203         (WebCore::RenderSVGBlock::graphicsElement):
204         * rendering/svg/RenderSVGGradientStop.cpp:
205         (WebCore::RenderSVGGradientStop::gradientElement):
206         * rendering/svg/RenderSVGInline.h:
207         (WebCore::RenderSVGInline::graphicsElement):
208         * rendering/svg/RenderSVGResourceClipper.cpp:
209         (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
210         * rendering/svg/RenderSVGResourceContainer.cpp:
211         (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke):
212         * rendering/svg/RenderSVGShape.h:
213         (WebCore::RenderSVGShape::graphicsElement):
214         * rendering/svg/RenderSVGTransformableContainer.h:
215         * rendering/svg/SVGRenderSupport.cpp:
216         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
217         * rendering/svg/SVGRenderTreeAsText.cpp:
218         (WebCore::operator<<):
219         * rendering/svg/SVGRenderingContext.cpp:
220         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
221         * rendering/svg/SVGResources.cpp:
222         (WebCore::targetReferenceFromResource):
223         * svg/SVGAElement.cpp:
224         (WebCore::SVGAElement::defaultEventHandler):
225         * svg/SVGAnimateElement.cpp:
226         (WebCore::SVGAnimateElement::calculateAnimatedValue):
227         * svg/SVGAnimationElement.cpp:
228         (WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
229         * svg/SVGElement.cpp:
230         (WebCore::SVGElement::getBoundingBox):
231         * svg/SVGLinearGradientElement.cpp:
232         (WebCore::SVGLinearGradientElement::collectGradientAttributes):
233         * svg/SVGLocatable.cpp:
234         (WebCore::SVGLocatable::getTransformToElement):
235         * svg/SVGPolyElement.cpp:
236         (WebCore::SVGPolyElement::synchronizePoints):
237         (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
238         * svg/SVGRadialGradientElement.cpp:
239         (WebCore::SVGRadialGradientElement::collectGradientAttributes):
240         * svg/SVGTextContentElement.cpp:
241         (WebCore::SVGTextContentElement::synchronizeTextLength):
242         (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
243         (WebCore::SVGTextContentElement::elementFromRenderer):
244         * svg/SVGUseElement.cpp:
245         (WebCore::SVGUseElement::toClipPath):
246         * svg/animation/SVGSMILElement.cpp:
247         (WebCore::SVGSMILElement::connectConditions):
248         (WebCore::SVGSMILElement::disconnectConditions):
249         * svg/graphics/SVGImage.cpp:
250         (WebCore::SVGImage::hasSingleSecurityOrigin):
251         (WebCore::SVGImage::setContainerSize):
252         (WebCore::SVGImage::containerSize):
253         (WebCore::SVGImage::embeddedContentBox):
254         (WebCore::SVGImage::hasRelativeWidth):
255         (WebCore::SVGImage::hasRelativeHeight):
256         (WebCore::SVGImage::computeIntrinsicDimensions):
257         (WebCore::SVGImage::startAnimation):
258         (WebCore::SVGImage::stopAnimation):
259
260 2014-09-22  Simon Fraser  <simon.fraser@apple.com>
261
262         Ensure that layout is up-to-date before hit-testing via RenderView
263         https://bugs.webkit.org/show_bug.cgi?id=136651
264
265         Reviewed by David Hyatt.
266
267         Ensure that layout is up-to-date before we do hit-testing via the RenderView.
268         Previously, RenderLayer::hitTest() called updateLayout(), but it's better
269         to push that responsibility onto RenderView before entering the RenderLayer
270         tree.
271         
272         Make callers a little more consistent in getting the RenderView via
273         Frame::contentRenderer(), though perhaps we should remove that and just
274         call Document::renderView() everywhere.
275
276         * accessibility/AccessibilityObject.cpp:
277         (WebCore::AccessibilityObject::press): Hit test via the RenderView, rather
278         than doing so on the RenderView's layer, to ensure that we updateLayout().
279         * accessibility/AccessibilityRenderObject.cpp:
280         (WebCore::AccessibilityRenderObject::accessibilityHitTest): This code calls
281         hitTest() on arbitrary layers, so needs to explicitly update layout.
282         * editing/FrameSelection.cpp:
283         (WebCore::FrameSelection::contains):
284         * page/EventHandler.cpp:
285         (WebCore::EventHandler::eventMayStartDrag):
286         (WebCore::EventHandler::updateSelectionForMouseDrag):
287         (WebCore::EventHandler::hitTestResultAtPoint): The explicit updateLayout() is
288         no longer needed.
289         (WebCore::EventHandler::updateCursor):
290         (WebCore::EventHandler::handleWheelEvent):
291         (WebCore::EventHandler::hoverTimerFired):
292         (WebCore::hitTestResultInFrame):
293         * page/Frame.cpp:
294         (WebCore::Frame::contentRenderer):
295         * rendering/RenderLayer.cpp:
296         (WebCore::RenderLayer::hitTest):
297         * rendering/RenderView.cpp:
298         (WebCore::RenderView::hitTest): Here's where we ensure that layout is up-to-date.
299
300 2014-09-22  Christophe Dumez  <cdumez@apple.com>
301
302         Use downcast<SVG*Element>() instead of toSVG*Element()
303         https://bugs.webkit.org/show_bug.cgi?id=137004
304
305         Reviewed by Benjamin Poulain.
306
307         Use downcast<SVG*Element>() instead of toSVG*Element() for casting SVG
308         Elements and get rid of the transition toSVG*Element() macros.
309
310         Also use downcast<MathML*Element>() instead of toMathML*Element() for
311         casting MathML Elements.
312
313         The HTML Elements casting counterparts will be taken care of in a
314         separate patch.
315
316         No new tests, no behavior change.
317
318         * accessibility/AccessibilityNodeObject.cpp:
319         (WebCore::AccessibilityNodeObject::alternativeText):
320         (WebCore::AccessibilityNodeObject::accessibilityDescription):
321         * accessibility/AccessibilityRenderObject.cpp:
322         (WebCore::AccessibilityRenderObject::remoteSVGRootElement):
323         * bindings/js/JSElementCustom.cpp:
324         (WebCore::toJSNewlyCreated):
325         * bindings/js/JSNodeCustom.cpp:
326         (WebCore::createWrapperInline):
327         * css/CSSComputedStyleDeclaration.cpp:
328         (WebCore::ComputedStyleExtractor::propertyValue):
329         * css/CSSCursorImageValue.cpp:
330         (WebCore::resourceReferencedByCursorElement):
331         (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed):
332         * css/ElementRuleCollector.cpp:
333         (WebCore::ElementRuleCollector::matchAllRules):
334         * css/StyleResolver.cpp:
335         (WebCore::StyleResolver::locateCousinList):
336         (WebCore::StyleResolver::canShareStyleWithElement):
337         (WebCore::StyleResolver::locateSharedStyle):
338         * dom/DocumentStyleSheetCollection.cpp:
339         (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
340         * dom/Element.cpp:
341         (WebCore::Element::synchronizeAllAttributes):
342         (WebCore::Element::synchronizeAttribute):
343         (WebCore::Element::boundsInRootViewSpace):
344         (WebCore::Element::getBoundingClientRect):
345         (WebCore::Element::childShouldCreateRenderer):
346         (WebCore::Element::fastAttributeLookupAllowed):
347         * dom/EventDispatcher.cpp:
348         (WebCore::eventTargetRespectingTargetRules):
349         * dom/ScriptElement.cpp:
350         (WebCore::toScriptElementIfPossible):
351         * dom/make_names.pl:
352         (printTypeHelpers):
353         * html/HTMLFrameOwnerElement.cpp:
354         (WebCore::HTMLFrameOwnerElement::getSVGDocument):
355         * inspector/InspectorCSSAgent.cpp:
356         (WebCore::InspectorCSSAgent::viaInspectorStyleSheet):
357         * mathml/MathMLElement.cpp:
358         (WebCore::MathMLElement::isPhrasingContent):
359         (WebCore::MathMLElement::childShouldCreateRenderer):
360         (WebCore::MathMLElement::attributeChanged):
361         * mathml/MathMLElement.h:
362         (WebCore::Node::hasTagName):
363         * mathml/MathMLSelectElement.cpp:
364         (WebCore::MathMLSelectElement::getSelectedSemanticsChild):
365         * page/EventHandler.cpp:
366         (WebCore::EventHandler::handleMousePressEvent):
367         (WebCore::EventHandler::handleMouseMoveEvent):
368         (WebCore::EventHandler::handleMouseReleaseEvent):
369         (WebCore::instanceAssociatedWithShadowTreeElement):
370         * page/Frame.cpp:
371         (WebCore::Frame::setPageAndTextZoomFactors):
372         * page/FrameView.cpp:
373         (WebCore::FrameView::scrollToAnchor):
374         * rendering/RenderTableCell.cpp:
375         (WebCore::RenderTableCell::parseColSpanFromDOM):
376         (WebCore::RenderTableCell::parseRowSpanFromDOM):
377         (WebCore::RenderTableCell::computePreferredLogicalWidths):
378         * rendering/mathml/RenderMathMLMenclose.cpp:
379         (WebCore::RenderMathMLMenclose::addChild):
380         (WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
381         (WebCore::RenderMathMLMenclose::updateLogicalHeight):
382         (WebCore::RenderMathMLMenclose::paint):
383         * rendering/svg/RenderSVGBlock.h:
384         (WebCore::RenderSVGBlock::graphicsElement):
385         * rendering/svg/RenderSVGForeignObject.cpp:
386         (WebCore::RenderSVGForeignObject::foreignObjectElement):
387         * rendering/svg/RenderSVGGradientStop.cpp:
388         (WebCore::RenderSVGGradientStop::gradientElement):
389         * rendering/svg/RenderSVGGradientStop.h:
390         * rendering/svg/RenderSVGImage.cpp:
391         (WebCore::RenderSVGImage::imageElement):
392         * rendering/svg/RenderSVGInline.h:
393         (WebCore::RenderSVGInline::graphicsElement):
394         * rendering/svg/RenderSVGModelObject.cpp:
395         (WebCore::getElementCTM):
396         (WebCore::RenderSVGModelObject::checkIntersection):
397         (WebCore::RenderSVGModelObject::checkEnclosure):
398         * rendering/svg/RenderSVGModelObject.h:
399         (WebCore::RenderSVGModelObject::element):
400         * rendering/svg/RenderSVGRect.cpp:
401         (WebCore::RenderSVGRect::rectElement):
402         * rendering/svg/RenderSVGResource.cpp:
403         (WebCore::removeFromCacheAndInvalidateDependencies):
404         * rendering/svg/RenderSVGResourceClipper.cpp:
405         (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
406         (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
407         * rendering/svg/RenderSVGResourceClipper.h:
408         * rendering/svg/RenderSVGResourceContainer.cpp:
409         (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke):
410         * rendering/svg/RenderSVGResourceFilter.h:
411         * rendering/svg/RenderSVGResourceLinearGradient.h:
412         * rendering/svg/RenderSVGResourceMarker.h:
413         * rendering/svg/RenderSVGResourceMasker.h:
414         * rendering/svg/RenderSVGResourcePattern.cpp:
415         (WebCore::RenderSVGResourcePattern::patternElement):
416         * rendering/svg/RenderSVGResourceRadialGradient.h:
417         * rendering/svg/RenderSVGRoot.cpp:
418         (WebCore::RenderSVGRoot::svgSVGElement):
419         * rendering/svg/RenderSVGShape.h:
420         (WebCore::RenderSVGShape::graphicsElement):
421         * rendering/svg/RenderSVGText.cpp:
422         (WebCore::RenderSVGText::textElement):
423         * rendering/svg/RenderSVGTextPath.cpp:
424         (WebCore::RenderSVGTextPath::textPathElement):
425         (WebCore::RenderSVGTextPath::layoutPath):
426         * rendering/svg/RenderSVGTransformableContainer.cpp:
427         (WebCore::RenderSVGTransformableContainer::calculateLocalTransform):
428         * rendering/svg/RenderSVGTransformableContainer.h:
429         * rendering/svg/RenderSVGViewportContainer.cpp:
430         (WebCore::RenderSVGViewportContainer::svgSVGElement):
431         * rendering/svg/SVGPathData.cpp:
432         (WebCore::updatePathFromLineElement):
433         (WebCore::updatePathFromPathElement):
434         (WebCore::updatePathFromPolygonElement):
435         (WebCore::updatePathFromPolylineElement):
436         * rendering/svg/SVGRenderSupport.cpp:
437         (WebCore::SVGRenderSupport::layoutChildren):
438         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
439         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
440         * rendering/svg/SVGRenderTreeAsText.cpp:
441         (WebCore::operator<<):
442         * rendering/svg/SVGRenderingContext.cpp:
443         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
444         * rendering/svg/SVGResources.cpp:
445         (WebCore::targetReferenceFromResource):
446         (WebCore::SVGResources::buildCachedResources):
447         * rendering/svg/SVGTextLayoutEngine.cpp:
448         (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
449         * svg/SVGAElement.cpp:
450         (WebCore::SVGAElement::createElementRenderer):
451         (WebCore::SVGAElement::defaultEventHandler):
452         * svg/SVGAltGlyphDefElement.cpp:
453         (WebCore::SVGAltGlyphDefElement::hasValidGlyphElements):
454         * svg/SVGAltGlyphElement.cpp:
455         (WebCore::SVGAltGlyphElement::hasValidGlyphElements):
456         * svg/SVGAnimateElement.cpp:
457         (WebCore::SVGAnimateElement::calculateAnimatedValue):
458         * svg/SVGAnimatedTransformList.cpp:
459         (WebCore::SVGAnimatedTransformListAnimator::SVGAnimatedTransformListAnimator):
460         * svg/SVGAnimationElement.cpp:
461         (WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
462         (WebCore::SVGAnimationElement::adjustForInheritance):
463         * svg/SVGDocument.cpp:
464         (WebCore::SVGDocument::rootElement):
465         * svg/SVGElement.cpp:
466         (WebCore::SVGElement::ownerSVGElement):
467         (WebCore::SVGElement::viewportElement):
468         (WebCore::SVGElement::getBoundingBox):
469         (WebCore::SVGElement::childShouldCreateRenderer):
470         (WebCore::SVGElement::title):
471         (WebCore::SVGElement::updateRelativeLengthsInformation):
472         * svg/SVGElement.h:
473         (WebCore::Node::hasTagName):
474         * svg/SVGFEComponentTransferElement.cpp:
475         (WebCore::SVGFEComponentTransferElement::build):
476         * svg/SVGFEImageElement.cpp:
477         (WebCore::SVGFEImageElement::buildPendingResource):
478         * svg/SVGFilterElement.cpp:
479         (WebCore::SVGFilterElement::childShouldCreateRenderer):
480         * svg/SVGFilterPrimitiveStandardAttributes.h:
481         (WebCore::isSVGFilterPrimitiveStandardAttributes):
482         * svg/SVGFontData.cpp:
483         (WebCore::SVGFontData::applySVGGlyphSelection):
484         * svg/SVGFontElement.cpp:
485         (WebCore::SVGFontElement::ensureGlyphCache):
486         * svg/SVGFontFaceElement.cpp:
487         (WebCore::SVGFontFaceElement::rebuildFontFace):
488         * svg/SVGFontFaceFormatElement.cpp:
489         (WebCore::SVGFontFaceFormatElement::childrenChanged):
490         * svg/SVGFontFaceSrcElement.cpp:
491         (WebCore::SVGFontFaceSrcElement::srcValue):
492         (WebCore::SVGFontFaceSrcElement::childrenChanged):
493         * svg/SVGFontFaceUriElement.cpp:
494         (WebCore::SVGFontFaceUriElement::childrenChanged):
495         * svg/SVGGlyphElement.cpp:
496         (WebCore::SVGGlyphElement::invalidateGlyphCache):
497         * svg/SVGGraphicsElement.h:
498         (WebCore::isSVGGraphicsElement):
499         * svg/SVGHKernElement.cpp:
500         (WebCore::SVGHKernElement::insertedInto):
501         (WebCore::SVGHKernElement::removedFrom):
502         * svg/SVGImageLoader.cpp:
503         (WebCore::SVGImageLoader::dispatchLoadEvent):
504         * svg/SVGLengthContext.cpp:
505         (WebCore::SVGLengthContext::determineViewport):
506         * svg/SVGLinearGradientElement.cpp:
507         (WebCore::setGradientAttributes):
508         (WebCore::SVGLinearGradientElement::collectGradientAttributes):
509         * svg/SVGLocatable.cpp:
510         (WebCore::SVGLocatable::nearestViewportElement):
511         (WebCore::SVGLocatable::farthestViewportElement):
512         (WebCore::SVGLocatable::computeCTM):
513         (WebCore::SVGLocatable::getTransformToElement):
514         * svg/SVGMPathElement.cpp:
515         (WebCore::SVGMPathElement::buildPendingResource):
516         (WebCore::SVGMPathElement::pathElement):
517         (WebCore::SVGMPathElement::notifyParentOfPathChange):
518         * svg/SVGMarkerElement.cpp:
519         (WebCore::SVGMarkerElement::synchronizeOrientType):
520         (WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper):
521         * svg/SVGPathElement.cpp:
522         (WebCore::SVGPathElement::invalidateMPathDependencies):
523         (WebCore::SVGPathElement::lookupOrCreateDWrapper):
524         (WebCore::SVGPathElement::synchronizeD):
525         * svg/SVGPathSegList.cpp:
526         (WebCore::SVGPathSegList::commitChange):
527         * svg/SVGPatternElement.cpp:
528         (WebCore::SVGPatternElement::collectPatternAttributes):
529         * svg/SVGPolyElement.cpp:
530         (WebCore::SVGPolyElement::synchronizePoints):
531         (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
532         * svg/SVGRadialGradientElement.cpp:
533         (WebCore::setGradientAttributes):
534         (WebCore::SVGRadialGradientElement::collectGradientAttributes):
535         * svg/SVGSVGElement.cpp:
536         (WebCore::SVGSVGElement::setupInitialView):
537         * svg/SVGTextContentElement.cpp:
538         (WebCore::SVGTextContentElement::synchronizeTextLength):
539         (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
540         (WebCore::SVGTextContentElement::elementFromRenderer):
541         * svg/SVGTextContentElement.h:
542         (WebCore::isSVGTextContentElement):
543         * svg/SVGTextPathElement.cpp:
544         (WebCore::SVGTextPathElement::buildPendingResource):
545         * svg/SVGUseElement.cpp:
546         (WebCore::dumpInstanceTree):
547         (WebCore::SVGUseElement::buildPendingResource):
548         (WebCore::SVGUseElement::toClipPath):
549         (WebCore::SVGUseElement::buildInstanceTree):
550         (WebCore::SVGUseElement::hasCycleUseReferencing):
551         (WebCore::SVGUseElement::expandUseElementsInShadowTree):
552         (WebCore::SVGUseElement::associateInstancesWithShadowTreeElements):
553         * svg/SVGVKernElement.cpp:
554         (WebCore::SVGVKernElement::insertedInto):
555         (WebCore::SVGVKernElement::removedFrom):
556         * svg/SVGViewSpec.cpp:
557         (WebCore::SVGViewSpec::viewTarget):
558         * svg/animation/SVGSMILElement.cpp:
559         (WebCore::SVGSMILElement::buildPendingResource):
560         (WebCore::SVGSMILElement::connectConditions):
561         (WebCore::SVGSMILElement::disconnectConditions):
562         * svg/animation/SVGSMILElement.h:
563         (WebCore::isSVGSMILElement):
564         * svg/graphics/SVGImage.cpp:
565         (WebCore::SVGImage::hasSingleSecurityOrigin):
566         (WebCore::SVGImage::setContainerSize):
567         (WebCore::SVGImage::containerSize):
568         (WebCore::SVGImage::embeddedContentBox):
569         (WebCore::SVGImage::hasRelativeWidth):
570         (WebCore::SVGImage::hasRelativeHeight):
571         (WebCore::SVGImage::computeIntrinsicDimensions):
572         (WebCore::SVGImage::startAnimation):
573         (WebCore::SVGImage::stopAnimation):
574         * svg/graphics/filters/SVGFEImage.cpp:
575         (WebCore::FEImage::platformApplySoftware):
576         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
577         (WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):
578         * svg/properties/SVGPathSegListPropertyTearOff.cpp:
579         (WebCore::SVGPathSegListPropertyTearOff::contextElement):
580
581 2014-09-22  Pratik Solanki  <psolanki@apple.com>
582
583         Follow on fix for [iOS] ASSERTION FAILED: WTF::isMainThread() in WebCore::memoryCache() when using WebKit1
584         https://bugs.webkit.org/show_bug.cgi?id=136962
585
586         Rubber-stamped by Simon Fraser.
587
588         Remove the const per review comment. It is not needed.
589
590         * loader/cocoa/DiskCacheMonitorCocoa.mm:
591         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
592
593 2014-09-22  Simon Fraser  <simon.fraser@apple.com>
594
595         Move nodeFromPoint() back to Document where it belongs
596         https://bugs.webkit.org/show_bug.cgi?id=137012
597
598         Reviewed by Zalan Bujtas.
599
600         nodeFromPoint() was moved into TreeScope for ShadowDOM work, but now we can move
601         it back to its logical place.
602         
603         Make versions of elementFromPoint and caretRangeFromPoint that take LayoutPoints,
604         and change the current scale/offset code to be in layout units (which results
605         in a small behavior change).
606         
607         elementFromPoint(int, int) and caretRangeFromPoint(int, int) are still required
608         for bindings code.
609
610         * dom/Document.cpp:
611         (WebCore::Document::nodeFromPoint):
612         (WebCore::Document::elementFromPoint):
613         (WebCore::Document::caretRangeFromPoint):
614         * dom/Document.h:
615         (WebCore::Document::elementFromPoint): Move logic from TreeScope::elementFromPoint()
616         here.
617         * dom/TreeScope.cpp:
618         (WebCore::nodeFromPoint): Deleted.
619         (WebCore::TreeScope::elementFromPoint): Deleted.
620         * dom/TreeScope.h:
621
622 2014-09-22  Benjamin Poulain  <bpoulain@apple.com>
623
624         Add the baseline implementation of :nth-child(An+B of selector-list)
625         https://bugs.webkit.org/show_bug.cgi?id=136975
626
627         Reviewed by Darin Adler.
628
629         Tests: fast/css/nth-child-of-classname.html
630                fast/css/nth-child-of-complex-selector.html
631                fast/css/nth-child-of-compound-selector.html
632                fast/css/nth-child-of-tagname.html
633                fast/selectors/nth-child-of-basics.html
634                fast/selectors/nth-child-of-class-style-update.html
635                fast/selectors/nth-child-of-complex-selectors.html
636                fast/selectors/nth-child-of-selector-list.html
637
638         * css/SelectorChecker.cpp:
639         (WebCore::SelectorChecker::checkOne):
640         Pretty basic:
641         -Go over the previous siblings.
642         -For each sibling, test the selector list. If it matches, increase the count.
643
644         * cssjit/SelectorCompiler.cpp:
645         (WebCore::SelectorCompiler::addPseudoClassType):
646         Skip any case of the new selector. This will be implemented separately.
647
648 2014-09-19  Myles C. Maxfield  <mmaxfield@apple.com>
649
650         Implement 'vhea', 'vmtx', and 'kern' tables in SVG -> OTF converter
651         https://bugs.webkit.org/show_bug.cgi?id=136971
652
653         Reviewed by Darin Adler.
654
655         This patch fills in the tables related to vertical metrics and kerning. The vertical metrics tables are
656         fairly straightforward. On the other hand, the 'kern' table has subtables which can be in a variety
657         of formats; however, according to Microsoft, Windows only allows one particular format, which doesn't
658         allow for ranges of glyphs to be described and therefore might lead to a large 'kern' table size. In
659         the interest of platform agnosticism I have implemented this particular format, and have not actually
660         witnessed any extremely large 'kern' tables in any of the fonts that I have looked at.
661
662         I also added basic support for the horiz-origin-x and horiz-origin-y SVG properties, though support
663         might not be perfect based on my testing.
664
665         Regarding testing, after this patch, almost all of our SVG fonts tests pass (barring tiny rebaselining;
666         the platform font system calculates slightly different advances than we did. These differences are tiny
667         and expected from such a dramatic shift in text handling engines.) There are around two dozen failing
668         tests left that look like they are actually indiciative of code problems.
669
670         * svg/SVGFontElement.cpp:
671         (WebCore::SVGFontElement::ensureGlyphCache): Refactor to accept new signature of
672         SVG*KernElement::build*KerningPair().
673         * svg/SVGHKernElement.cpp:
674         (WebCore::SVGHKernElement::buildHorizontalKerningPair): Refactor to allow for intermediate data to be
675         returned, which the SVG -> OTF font converter can use.
676         * svg/SVGHKernElement.h: New signature for buildHorizontalKerningPair().
677         * svg/SVGToOTFFontConversion.cpp:
678         (WebCore::SVGToOTFFontConverter::GlyphData::GlyphData): Save the glyph's vertical advance along with
679         the glyph's horizontal advance.
680         (WebCore::SVGToOTFFontConverter::KerningData::KerningData): This data represents a record in one of
681         the two 'kern' subtables, and as such needs to be sorted.
682         (WebCore::SVGToOTFFontConverter::KerningData::operator<): Sort comparator.
683         (WebCore::SVGToOTFFontConverter::appendHEADTable): Save the unitsPerEm locally to save a conditional.
684         (WebCore::SVGToOTFFontConverter::appendHHEATable): Ditto.
685         (WebCore::SVGToOTFFontConverter::appendHMTXTable): Ditto. Also use the horizontal advance as opposed to
686         the vertical advance.
687         (WebCore::SVGToOTFFontConverter::appendOS2Table): Save the unitsPerEm locally to save a conditional.
688         Also if the average advance isn't found in the font, use the missing glyph's advance. If there is no
689         missing glyph, bail and use the unitsPerEm.
690         (WebCore::SVGToOTFFontConverter::appendVORGTable): If the default vertical origin isn't found in the
691         font, use the missing glyphs's vertical origin. If there is no missing glyph, bail and use 0.
692         (WebCore::SVGToOTFFontConverter::appendVHEATable): Parallel of 'hhea' table, except for vertical info.
693         (WebCore::SVGToOTFFontConverter::appendVMTXTable): Parallel of 'hmtx' table, except for vertical info.
694         (WebCore::SVGToOTFFontConverter::appendKerningHelperFields): Computes and appends 4 fields that font
695         parsers need in order to do a binary search on the kern records.
696         (WebCore::SVGToOTFFontConverter::addCodepointRanges): For each codepoint in the ranges, look up its
697         representative glyph and append it to a set.
698         (WebCore::SVGToOTFFontConverter::addCodepoints): For each codepoint in the range, look up its
699         representative glyph and append it to a set.
700         (WebCore::SVGToOTFFontConverter::addGlyphNames): For each glyph name, look up its representative glyph
701         and append it to a set.
702         (WebCore::SVGToOTFFontConverter::computeKerningData): Call SVG*KernElement::build*KerningPair() and
703         iterate through all the data it returned, building up records into a Vector.
704         (WebCore::SVGToOTFFontConverter::appendKERNTable): Go through the vector that computeKerningData()
705         returned and actually write out the two subtables. One is for horizontal kerning and the other is for
706         vertical kerning.
707         (WebCore::CFFBuilder::CFFBuilder): Use the position of the glyph origin to perform the initial moveto
708         command.
709         (WebCore::transcodeGlyphPaths): Get the glyph's origin and pass it to the CFFBuilder.
710         (WebCore::SVGToOTFFontConverter::appendGlyphData): Templated overloading so that the missing glyph
711         gets a null SVGGlyphElement pointer but the rest of the glyphs get a non-null one.
712         (WebCore::SVGToOTFFontConverter::processGlyphElement): Called on both SVGGlyphElements and
713         SVGMissingGlyphElements, this pulls out information from the element and computs its path information.
714         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Use the new templated version of
715         processGlyphElement so we can get the same glyph parsing behavior on SVGMissingGlyphElements. In
716         addition, populate two maps for the kerning table creation function to use.
717         (WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): Append new tables.
718         * svg/SVGVKernElement.cpp:
719         (WebCore::SVGVKernElement::buildVerticalKerningPair): Refactor to allow for intermediate data to be
720         returned, which the SVG -> OTF font converter can use.
721         * svg/SVGVKernElement.h: New signature for buildVerticalKerningPair().
722
723 2014-09-22  Alexey Proskuryakov  <ap@apple.com>
724
725         WebSocket crash when a connection is closed from server side
726         https://bugs.webkit.org/show_bug.cgi?id=137009
727         rdar://problem/18333977
728         rdar://problem/12708225
729
730         Reviewed by Brady Eidson.
731
732         I don't think that this can be tested with our test server.
733
734         * Modules/websockets/WebSocketChannel.cpp:
735         (WebCore::WebSocketChannel::WebSocketChannel): Added logging.
736         (WebCore::WebSocketChannel::~WebSocketChannel): Ditto.
737         (WebCore::WebSocketChannel::close): Protect self, because startClosingHandshake
738         can release the last reference.
739         (WebCore::WebSocketChannel::fail): Added an assertion that the channel is always
740         closed after this function.
741         (WebCore::WebSocketChannel::startClosingHandshake): Protect self, and don't change
742         the stack from closed back to closing if after failing to send closing handshake.
743         (WebCore::WebSocketChannel::processOutgoingFrameQueue): Protect self.
744
745 2014-09-22  David Hyatt  <hyatt@apple.com>
746
747         Bad cast in isValidColumnSpanner.
748         https://bugs.webkit.org/show_bug.cgi?id=133380.
749
750         Reviewed by Simon Fraser.
751
752         Added fast/multicol/multicol-crazy-nesting.html
753
754         * rendering/RenderMultiColumnFlowThread.cpp:
755         (WebCore::isValidColumnSpanner):
756         The crawl up the chain looking for unsplittable objects should use containing blocks
757         and not be casting to parent boxes. You can have an inline in the parent chain, so
758         this was not the right way to walk up the tree.
759
760 2014-09-22  David Hyatt  <hyatt@apple.com>
761
762         ASSERT in RenderMultiColumnSet::requiresBalancing.
763         https://bugs.webkit.org/show_bug.cgi?id=136376.
764
765         Reviewed by David Kilzer.
766
767         Added fast/multicol/multicol-selection.html.
768
769         * rendering/RenderMultiColumnFlowThread.cpp:
770         (WebCore::isValidColumnSpanner):
771         Don't allow an object to become a spanner if it does not have the flow
772         thread as its containing block. Otherwise the flow thread won't get notified
773         of spanner placeholder insertions, and so the spanner ends up orphaned.
774
775 2014-09-19  Brent Fulgham  <bfulgham@apple.com>
776
777         [Win] Implement cap height in SimpleFontDataWin to enable initial-letter support for Windows.
778         https://bugs.webkit.org/show_bug.cgi?id=136841
779
780         Reviewed by David Hyatt.
781
782         * platform/graphics/win/SimpleFontDataCGWin.cpp:
783         (WebCore::SimpleFontData::platformInit): Add missing calls to set up our fonts.
784
785 2014-09-22  Eric Carlson  <eric.carlson@apple.com>
786
787         Update HTMLMediaElement logging
788         https://bugs.webkit.org/show_bug.cgi?id=136991
789
790         Reviewed by Alexey Proskuryakov.
791
792         No new tests, only logging was changed.
793
794         * html/HTMLMediaElement.cpp:
795         (WebCore::HTMLMediaElement::HTMLMediaElement):
796         (WebCore::HTMLMediaElement::~HTMLMediaElement):
797         (WebCore::HTMLMediaElement::parseAttribute):
798
799 2014-09-22  Eva Balazsfalvi  <evab.u-szeged@partner.samsung.com>
800
801         REGRESSION(r173631): It broke the !ENABLE(VIDEO) build
802         https://bugs.webkit.org/show_bug.cgi?id=136946
803
804         Reviewed by Jer Noble.
805
806         No new tests required, no new functionality.
807
808         * page/DragController.cpp:
809         (WebCore::DragController::startDrag):
810
811 2014-09-22  Mihnea Ovidenie  <mihnea@adobe.com>
812
813         [CSSRegions] Use nullptr in regions code
814         https://bugs.webkit.org/show_bug.cgi?id=137001
815
816         Reviewed by Andrei Bucur.
817
818         No new tests as no new functionality is introduced.
819
820         * dom/DOMNamedFlowCollection.cpp:
821         (WebCore::DOMNamedFlowCollection::item):
822         (WebCore::DOMNamedFlowCollection::namedItem):
823         * dom/NamedFlowCollection.cpp:
824         (WebCore::NamedFlowCollection::flowByName):
825         * dom/WebKitNamedFlow.cpp:
826         (WebCore::WebKitNamedFlow::WebKitNamedFlow):
827         * rendering/RenderFlowThread.cpp:
828         (WebCore::RenderFlowThread::getLayerListForRegion):
829         (WebCore::RenderFlowThread::regionForCompositedLayer):
830         (WebCore::RenderFlowThread::regionAtBlockOffset):
831         (WebCore::RenderFlowThread::mapFromFlowToRegion):
832         (WebCore::RenderFlowThread::firstRegion):
833         (WebCore::RenderFlowThread::lastRegion):
834         (WebCore::RenderFlowThread::currentActiveRenderBox):
835         * rendering/RenderNamedFlowThread.cpp:
836         (WebCore::RenderNamedFlowThread::nextRendererForElement):
837
838 2014-09-17  Philippe Normand  <pnormand@igalia.com>
839
840         [GStreamer] Cannot play Vimeo video
841         https://bugs.webkit.org/show_bug.cgi?id=134969
842
843         Reviewed by Sergio Villar Senin.
844
845         Ensure the GStreamer HTTP source element also sends cookies when
846         it's sending its requests. Some streaming platforms such as Vimeo
847         do server-side cookie checks on incoming requests before serving
848         media data.
849
850         Test: http/tests/media/hls/video-cookie.html
851
852         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
853         (webKitWebSrcStart): Set first-party cookie URL to the request so
854         the ResourceLoader properly sets cookies in the HTTP request.
855
856 2014-09-22  Mihnea Ovidenie  <mihnea@adobe.com>
857
858         Leverage RenderLayerBacking::renderer() instead of m_owningLayer.renderer()
859         https://bugs.webkit.org/show_bug.cgi?id=136954
860
861         Reviewed by Darin Adler.
862
863         No new tests just refactoring.
864
865         * rendering/RenderLayerBacking.cpp:
866         (WebCore::RenderLayerBacking::updateCompositedBounds):
867         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
868         (WebCore::RenderLayerBacking::paintIntoLayer):
869
870 2014-09-22  Mihnea Ovidenie  <mihnea@adobe.com>
871
872         [CSS Regions] Assertion failure and null dereference crash when using animations and regions
873         https://bugs.webkit.org/show_bug.cgi?id=136918
874
875         Reviewed by Andrei Bucur.
876
877         In some situations, for instance when an image has an attached animation, the style change caused by the animation
878         triggers a geometry update for the backing store associated with the image's layer. This may occur before
879         the layout for the image has finished.
880
881         Moreover, if the image in such situation - having a composited layer - is displayed in a region,
882         sicne the layout did not finish yet, the mappings between the layers of the elements collected in the named flow
883         and the regions associated with the named flow are not updated and cannot be used.
884
885         Therefore in those situations, we have to bail out early and use these mappings only after the layout has finished.
886
887         This patch also changes RenderLayerBacking method updateAfterDescendents -> updateAfterDescendants.
888
889         Test: fast/regions/animated-image-in-region.html
890
891         * rendering/RenderFlowThread.cpp:
892         (WebCore::RenderFlowThread::cachedRegionForCompositedLayer):
893         * rendering/RenderLayer.cpp:
894         (WebCore::RenderLayer::calculateClipRects):
895         * rendering/RenderLayerBacking.cpp:
896         (WebCore::RenderLayerBacking::updateAfterDescendants):
897         * rendering/RenderLayerBacking.h:
898         * rendering/RenderLayerCompositor.cpp:
899         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
900         (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
901         (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
902
903 2014-09-21  Chris Dumez  <cdumez@apple.com>
904
905         Generate Element casting helper functions
906         https://bugs.webkit.org/show_bug.cgi?id=136839
907
908         Reviewed by Darin Adler.
909
910         Generate Element casting helper functions instead of requiring explicit
911         use of NODE_TYPE_CASTS() macro. Casting is now done using the following
912         form: downcast<HTMLDivElement>(), instead of toHTMLDivElement().
913
914         The previous form (i.e. toHTMLDivElement()) is still supported for now
915         by generating macros that convert these calls into the new form, until
916         the code base is ported to the new casting helpers.
917
918         The plan is also to use is<HTMLDivElement>() instead of
919         isHTMLDivElement() for consistency but this was not changed in this
920         patch to avoid blowing up the size.
921
922         This CL also updates the way we convert a JSValue into an
923         implementation pointer. Instead of using toHTMLDivElement(), which
924         looked like a cast, we now use JSHTMLDivElement::toWrapped(). This
925         avoids conflicting with the toXXXElement() macros and makes it
926         clearer this is not a simple cast.
927
928         No new tests, no behavior change.
929
930         * Modules/plugins/QuickTimePluginReplacement.mm:
931         (WebCore::QuickTimePluginReplacement::installReplacement):
932         * WebCore.exp.in:
933         * bindings/js/JSAudioBufferSourceNodeCustom.cpp:
934         (WebCore::JSAudioBufferSourceNode::setBuffer):
935         * bindings/js/JSBlobCustom.cpp:
936         (WebCore::constructJSBlob):
937         * bindings/js/JSCommandLineAPIHostCustom.cpp:
938         (WebCore::JSCommandLineAPIHost::getEventListeners):
939         (WebCore::JSCommandLineAPIHost::databaseId):
940         (WebCore::JSCommandLineAPIHost::storageId):
941         * bindings/js/JSDOMFormDataCustom.cpp:
942         (WebCore::toHTMLFormElementOrNull):
943         (WebCore::constructJSDOMFormData):
944         (WebCore::JSDOMFormData::append):
945         (WebCore::toHTMLFormElement): Deleted.
946         * bindings/js/JSDOMStringListCustom.cpp:
947         (WebCore::JSDOMStringList::toWrapped):
948         (WebCore::toDOMStringList): Deleted.
949         * bindings/js/JSDOMWindowCustom.cpp:
950         (WebCore::JSDOMWindow::toWrapped):
951         (WebCore::toDOMWindow): Deleted.
952         * bindings/js/JSDictionary.cpp:
953         (WebCore::JSDictionary::convertValue):
954         * bindings/js/JSDocumentCustom.cpp:
955         (WebCore::JSDocument::createTouchList):
956         * bindings/js/JSEventTargetCustom.cpp:
957         (WebCore::JSEventTarget::toWrapped):
958         (WebCore::toEventTarget): Deleted.
959         * bindings/js/JSExceptionBase.cpp:
960         (WebCore::toExceptionBase):
961         * bindings/js/JSHTMLMediaElementCustom.cpp:
962         (WebCore::JSHTMLMediaElement::setController):
963         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
964         (WebCore::JSHTMLOptionsCollection::add):
965         (WebCore::JSHTMLOptionsCollection::remove):
966         * bindings/js/JSHTMLSelectElementCustom.cpp:
967         (WebCore::JSHTMLSelectElement::remove):
968         (WebCore::selectIndexSetter):
969         * bindings/js/JSInspectorFrontendHostCustom.cpp:
970         (WebCore::JSInspectorFrontendHost::showContextMenu):
971         * bindings/js/JSMessageEventCustom.cpp:
972         (WebCore::handleInitMessageEvent):
973         * bindings/js/JSMessagePortCustom.cpp:
974         (WebCore::fillMessagePortArray):
975         * bindings/js/JSNodeCustom.cpp:
976         (WebCore::JSNode::insertBefore):
977         (WebCore::JSNode::replaceChild):
978         (WebCore::JSNode::removeChild):
979         (WebCore::JSNode::appendChild):
980         * bindings/js/JSNodeFilterCustom.cpp:
981         (WebCore::JSNodeFilter::toWrapped):
982         (WebCore::toNodeFilter): Deleted.
983         * bindings/js/JSSubtleCryptoCustom.cpp:
984         (WebCore::JSSubtleCrypto::encrypt):
985         (WebCore::JSSubtleCrypto::decrypt):
986         (WebCore::JSSubtleCrypto::sign):
987         (WebCore::JSSubtleCrypto::verify):
988         (WebCore::JSSubtleCrypto::exportKey):
989         (WebCore::JSSubtleCrypto::wrapKey):
990         (WebCore::JSSubtleCrypto::unwrapKey):
991         * bindings/js/JSWebGLRenderingContextCustom.cpp:
992         (WebCore::JSWebGLRenderingContext::getAttachedShaders):
993         (WebCore::JSWebGLRenderingContext::getProgramParameter):
994         (WebCore::JSWebGLRenderingContext::getShaderParameter):
995         (WebCore::JSWebGLRenderingContext::getUniform):
996         (WebCore::dataFunctionf):
997         (WebCore::dataFunctioni):
998         (WebCore::dataFunctionMatrix):
999         * bindings/js/JSXMLHttpRequestCustom.cpp:
1000         (WebCore::JSXMLHttpRequest::send):
1001         * bindings/js/SerializedScriptValue.cpp:
1002         (WebCore::CloneSerializer::dumpIfTerminal):
1003         * bindings/scripts/CodeGeneratorJS.pm:
1004         (GenerateHeader):
1005         (GenerateImplementation):
1006         (GenerateParametersCheck):
1007         (JSValueToNative):
1008         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1009         (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
1010         (WebCore::JSTestActiveDOMObject::toWrapped):
1011         (WebCore::toTestActiveDOMObject): Deleted.
1012         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1013         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1014         (WebCore::JSTestCustomNamedGetter::toWrapped):
1015         (WebCore::toTestCustomNamedGetter): Deleted.
1016         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1017         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1018         (WebCore::JSTestEventConstructor::toWrapped):
1019         (WebCore::toTestEventConstructor): Deleted.
1020         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1021         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1022         (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):
1023         (WebCore::JSTestEventTarget::toWrapped):
1024         (WebCore::toTestEventTarget): Deleted.
1025         * bindings/scripts/test/JS/JSTestEventTarget.h:
1026         * bindings/scripts/test/JS/JSTestException.cpp:
1027         (WebCore::JSTestException::toWrapped):
1028         (WebCore::toTestException): Deleted.
1029         * bindings/scripts/test/JS/JSTestException.h:
1030         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1031         (WebCore::JSTestGenerateIsReachable::toWrapped):
1032         (WebCore::toTestGenerateIsReachable): Deleted.
1033         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
1034         * bindings/scripts/test/JS/JSTestInterface.cpp:
1035         (WebCore::setJSTestInterfaceImplementsNode):
1036         (WebCore::setJSTestInterfaceSupplementalNode):
1037         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
1038         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
1039         (WebCore::JSTestInterface::toWrapped):
1040         (WebCore::toTestInterface): Deleted.
1041         * bindings/scripts/test/JS/JSTestInterface.h:
1042         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1043         (WebCore::JSTestMediaQueryListListener::toWrapped):
1044         (WebCore::toTestMediaQueryListListener): Deleted.
1045         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
1046         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1047         (WebCore::JSTestNamedConstructor::toWrapped):
1048         (WebCore::toTestNamedConstructor): Deleted.
1049         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
1050         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1051         (WebCore::JSTestNondeterministic::toWrapped):
1052         (WebCore::toTestNondeterministic): Deleted.
1053         * bindings/scripts/test/JS/JSTestNondeterministic.h:
1054         * bindings/scripts/test/JS/JSTestObj.cpp:
1055         (WebCore::setJSTestObjTestObjAttr):
1056         (WebCore::setJSTestObjXMLObjAttr):
1057         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
1058         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
1059         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
1060         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
1061         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
1062         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
1063         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
1064         (WebCore::setJSTestObjMutablePoint):
1065         (WebCore::setJSTestObjImmutablePoint):
1066         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
1067         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
1068         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
1069         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
1070         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
1071         (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg):
1072         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
1073         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
1074         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
1075         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
1076         (WebCore::jsTestObjPrototypeFunctionConvert1):
1077         (WebCore::jsTestObjPrototypeFunctionConvert2):
1078         (WebCore::jsTestObjPrototypeFunctionConvert4):
1079         (WebCore::jsTestObjPrototypeFunctionConvert5):
1080         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
1081         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
1082         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1083         (WebCore::JSTestObj::toWrapped):
1084         (WebCore::toTestObj): Deleted.
1085         * bindings/scripts/test/JS/JSTestObj.h:
1086         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1087         (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3):
1088         (WebCore::JSTestOverloadedConstructors::toWrapped):
1089         (WebCore::toTestOverloadedConstructors): Deleted.
1090         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
1091         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1092         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
1093         (WebCore::toTestSerializedScriptValueInterface): Deleted.
1094         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1095         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1096         (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
1097         (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):
1098         (WebCore::JSTestTypedefs::toWrapped):
1099         (WebCore::toTestTypedefs): Deleted.
1100         * bindings/scripts/test/JS/JSTestTypedefs.h:
1101         * bindings/scripts/test/JS/JSattribute.cpp:
1102         (WebCore::JSattribute::toWrapped):
1103         (WebCore::toattribute): Deleted.
1104         * bindings/scripts/test/JS/JSattribute.h:
1105         * bindings/scripts/test/JS/JSreadonly.cpp:
1106         (WebCore::JSreadonly::toWrapped):
1107         (WebCore::toreadonly): Deleted.
1108         * bindings/scripts/test/JS/JSreadonly.h:
1109         * dom/Element.h:
1110         (WebCore::downcast):
1111         * dom/make_names.pl:
1112         (printTypeHelpers):
1113         * html/HTMLAnchorElement.h:
1114         * html/HTMLAreaElement.h:
1115         * html/HTMLAudioElement.h:
1116         * html/HTMLBaseElement.h:
1117         * html/HTMLBodyElement.h:
1118         * html/HTMLCanvasElement.h:
1119         * html/HTMLDataListElement.h:
1120         * html/HTMLDetailsElement.h:
1121         * html/HTMLDivElement.h:
1122         * html/HTMLEmbedElement.h:
1123         * html/HTMLFieldSetElement.h:
1124         * html/HTMLFormElement.h:
1125         * html/HTMLFrameElement.h:
1126         * html/HTMLFrameSetElement.h:
1127         * html/HTMLHtmlElement.h:
1128         * html/HTMLIFrameElement.h:
1129         * html/HTMLImageElement.h:
1130         * html/HTMLInputElement.h:
1131         * html/HTMLLabelElement.h:
1132         * html/HTMLLegendElement.h:
1133         * html/HTMLLinkElement.h:
1134         * html/HTMLMapElement.h:
1135         * html/HTMLMarqueeElement.h:
1136         * html/HTMLMetaElement.h:
1137         * html/HTMLMeterElement.h:
1138         * html/HTMLOListElement.h:
1139         * html/HTMLObjectElement.h:
1140         * html/HTMLOptGroupElement.h:
1141         * html/HTMLOptionElement.h:
1142         * html/HTMLParamElement.h:
1143         * html/HTMLProgressElement.h:
1144         * html/HTMLScriptElement.h:
1145         * html/HTMLSelectElement.h:
1146         * html/HTMLSourceElement.h:
1147         * html/HTMLStyleElement.h:
1148         * html/HTMLSummaryElement.h:
1149         * html/HTMLTableCaptionElement.h:
1150         * html/HTMLTableElement.h:
1151         * html/HTMLTableRowElement.h:
1152         * html/HTMLTemplateElement.h:
1153         * html/HTMLTextAreaElement.h:
1154         * html/HTMLTitleElement.h:
1155         * html/HTMLTrackElement.h:
1156         * html/HTMLVideoElement.h:
1157         * inspector/InspectorDOMAgent.cpp:
1158         (WebCore::InspectorDOMAgent::scriptValueAsNode):
1159         * mathml/MathMLMencloseElement.h:
1160         * svg/SVGAltGlyphDefElement.h:
1161         * svg/SVGAltGlyphElement.h:
1162         * svg/SVGAltGlyphItemElement.h:
1163         * svg/SVGAnimateMotionElement.h:
1164         * svg/SVGAnimateTransformElement.h:
1165         * svg/SVGCircleElement.h:
1166         * svg/SVGClipPathElement.h:
1167         * svg/SVGCursorElement.h:
1168         * svg/SVGEllipseElement.h:
1169         * svg/SVGFEDistantLightElement.h:
1170         * svg/SVGFEFuncAElement.h:
1171         * svg/SVGFEFuncBElement.h:
1172         * svg/SVGFEFuncGElement.h:
1173         * svg/SVGFEFuncRElement.h:
1174         * svg/SVGFEMergeNodeElement.h:
1175         * svg/SVGFEPointLightElement.h:
1176         * svg/SVGFESpotLightElement.h:
1177         * svg/SVGFilterElement.h:
1178         * svg/SVGFontElement.h:
1179         * svg/SVGFontFaceElement.h:
1180         * svg/SVGFontFaceNameElement.h:
1181         * svg/SVGFontFaceSrcElement.h:
1182         * svg/SVGFontFaceUriElement.h:
1183         * svg/SVGForeignObjectElement.h:
1184         * svg/SVGGlyphElement.h:
1185         * svg/SVGGlyphRefElement.h:
1186         * svg/SVGHKernElement.h:
1187         * svg/SVGImageElement.h:
1188         * svg/SVGLineElement.h:
1189         * svg/SVGLinearGradientElement.h:
1190         * svg/SVGMPathElement.h:
1191         * svg/SVGMarkerElement.h:
1192         * svg/SVGMaskElement.h:
1193         * svg/SVGMissingGlyphElement.h:
1194         * svg/SVGPathElement.h:
1195         * svg/SVGPatternElement.h:
1196         * svg/SVGPolygonElement.h:
1197         * svg/SVGPolylineElement.h:
1198         * svg/SVGRadialGradientElement.h:
1199         * svg/SVGRectElement.h:
1200         * svg/SVGSVGElement.h:
1201         * svg/SVGScriptElement.h:
1202         * svg/SVGStopElement.h:
1203         * svg/SVGStyleElement.h:
1204         * svg/SVGTextElement.h:
1205         * svg/SVGTextPathElement.h:
1206         * svg/SVGTitleElement.h:
1207         * svg/SVGUseElement.h:
1208         * svg/SVGVKernElement.h:
1209         * svg/SVGViewElement.h:
1210
1211 2014-09-21  Christophe Dumez  <cdumez@apple.com>
1212
1213         Fix post-mortem nits for r173724
1214         https://bugs.webkit.org/show_bug.cgi?id=136986
1215
1216         Reviewed by Darin Adler.
1217
1218         Fix post-mortem nits for r173724.
1219
1220         No new tests, no behavior change.
1221
1222         * editing/EditingStyle.cpp:
1223         (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
1224         (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
1225         Use nullptr instead of 0.
1226
1227         * editing/SplitElementCommand.cpp:
1228         (WebCore::SplitElementCommand::doUnapply):
1229         Use getIdAttribute() / setIdAttribute().
1230
1231         * rendering/RenderTableCell.cpp:
1232         (WebCore::RenderTableCell::computePreferredLogicalWidths):
1233         Use fastHasAttribute() for nowrap and do an early return to avoid
1234         calling styleOrColLogicalWidth() if the nowrap attribute is missing.
1235
1236 2014-09-21  Filip Pizlo  <fpizlo@apple.com>
1237
1238         Unreviewed, speculative build fix.
1239         
1240         If you use typed arrays, you gotta include runtime/TypedArrayInlines.h.
1241
1242         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
1243
1244 2014-09-19  Jer Noble  <jer.noble@apple.com>
1245
1246         [EME][Mac] Support secure proof of key release in the com.apple.fps.2_0 keysystem.
1247         https://bugs.webkit.org/show_bug.cgi?id=136898
1248
1249         Reviewed by Eric Carlson.
1250
1251         Add support for proof of key release to the CDM by supporting a new "mime" type called
1252         "keyrelease". When a session of type "keyrelease" is created, the initData is the server
1253         certificate, the keyMessage contains the first stored proof of key release if present,
1254         and closing the session will remove that proof from storage.
1255
1256         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1257         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType):
1258         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
1259         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
1260         (WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC):
1261         (WebCore::CDMSessionMediaSourceAVFObjC::generateKeyRequest):
1262         (WebCore::CDMSessionMediaSourceAVFObjC::releaseKeys):
1263         (WebCore::sessionStorageDirectory):
1264         (WebCore::CDMSessionMediaSourceAVFObjC::update):
1265         (WebCore::CDMSessionMediaSourceAVFObjC::generateKeyReleaseMessage):
1266
1267 2014-09-19  Jer Noble  <jer.noble@apple.com>
1268
1269         [Media][Mac] Buffered range slides around as you resize a window
1270         https://bugs.webkit.org/show_bug.cgi?id=136960
1271
1272         Reviewed by Dean Jackson.
1273
1274         Rather than using a canvas as the background image for the timeline slider, use a generated SVG image
1275         to represent the buffered ranges.
1276
1277         * Modules/mediacontrols/mediaControlsApple.css:
1278         (audio::-webkit-media-controls-timeline):
1279         * Modules/mediacontrols/mediaControlsApple.js:
1280         (Controller.prototype.createControls):
1281         (Controller.prototype.updateProgress):
1282
1283 2014-09-19  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
1284
1285         [CoordinatedGraphics][EFL] window.scrollTo(x, y) doesn't work when fixed layout is enabled
1286         https://bugs.webkit.org/show_bug.cgi?id=136917
1287
1288         Reviewed by Darin Adler.
1289
1290         When fixed layout is enabled, scrollTo doesn't work on EFL port with coordinated graphics.
1291         Since updateScrollbars() doesn't update scroll position when delegatesScrolling() is enabled. 
1292         To fix this issue, EFL port should update scroll position based on WK2 port. This patch
1293         update scroll position in FrameView::requestScrollPositionUpdate() as Mac port.
1294
1295         TestWebKitAPI: Tools/TestWebKitAPI/Tests/WebKit2/efl/WKViewScrollTo
1296
1297         * page/FrameView.cpp:
1298         (WebCore::FrameView::requestScrollPositionUpdate):
1299
1300 2014-09-19  Brent Fulgham  <bfulgham@apple.com>
1301
1302         Latching in iframes is not working as expected
1303         https://bugs.webkit.org/show_bug.cgi?id=136729
1304         <rdar://problem/18370549>
1305
1306         Reviewed by Simon Fraser.
1307
1308         Test: platform/mac/fast/scrolling/scrolling-iframe-100pct.html
1309
1310         Correct latching behavior by moving the concept of latching from the event handler to the main frame.
1311         The event handlers are per-document, and can improperly latch to the iframe element (rather than the
1312         scrollable content of the iframe) resulting in incorrect behavior.
1313
1314         Also move the wheel event delta tracking to the main frame, as this is similarly "top-level" in nature.
1315
1316         * WebCore.vcxproj/WebCore.vcxproj: Add new LatchedState class.
1317         * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
1318         * WebCore.xcodeproj/project.pbxproj: Ditto.
1319         * page/EventHandler.cpp:
1320         (WebCore::EventHandler::EventHandler): Update constructor after moving some members to the new
1321         LatchedState object.
1322         (WebCore::EventHandler::clear): Call 'clear' on the LatchedState class.
1323         (WebCore::EventHandler::platformRecordWheelEvent):  Update for new LatchedState class.
1324         (WebCore::EventHandler::handleWheelEvent): Ditto.
1325         (WebCore::EventHandler::clearLatchedState): Ditto.
1326         (WebCore::EventHandler::defaultWheelEventHandler): Ditto.
1327         * page/EventHandler.h:
1328         * page/LatchedState.cpp: Added.
1329         (WebCore::LatchedState::LatchedState):
1330         (WebCore::LatchedState::~LatchedState):
1331         (WebCore::LatchedState::clear):
1332         (WebCore::LatchedState::setWheelEventElement):
1333         (WebCore::LatchedState::setWidgetIsLatched):
1334         (WebCore::LatchedState::setPreviousWheelScrolledElement):
1335         (WebCore::LatchedState::setScrollableContainer):
1336         * page/LatchedState.h: Added.
1337         (WebCore::LatchedState::wheelEventElement):
1338         (WebCore::LatchedState::frame):
1339         (WebCore::LatchedState::setFrame):
1340         (WebCore::LatchedState::widgetIsLatched):
1341         (WebCore::LatchedState::previousWheelScrolledElement):
1342         (WebCore::LatchedState::scrollableContainer):
1343         (WebCore::LatchedState::startedGestureAtScrollLimit):
1344         (WebCore::LatchedState::setStartedGestureAtScrollLimit):
1345         * page/MainFrame.cpp:
1346         (WebCore::MainFrame::MainFrame): Update for new members (LatchedState and WheelEventDeltaTracker)
1347         * page/MainFrame.h:
1348         * page/mac/EventHandlerMac.mm:
1349         (WebCore::EventHandler::platformPrepareForWheelEvents): Use mainFrame-located latching information.
1350         (WebCore::EventHandler::platformRecordWheelEvent): Use mainFrame-located wheel event delta tracking.
1351         (WebCore::EventHandler::platformCompleteWheelEvent): Make sure to use the latched frame as well as
1352         the latched element so that events get routed properly.
1353         (WebCore::EventHandler::platformCompletePlatformWidgetWheelEvent): Update for new mainFrame
1354         location for latched state information.
1355
1356 2014-09-19  Chris Dumez  <cdumez@apple.com>
1357
1358         Minimize virtual function calls in MarkupAccumulator
1359         https://bugs.webkit.org/show_bug.cgi?id=136957
1360
1361         Reviewed by Benjamin Poulain.
1362
1363         This patch minimizes the number of virtual function calls in
1364         MarkupAccumulator by:
1365         - De-virtualizing MarkupAccumulator::appendString(), which is never
1366           overridden
1367         - Having MarkupAccumulator::appendEndTag() virtual function take an
1368           Element in argument instead of a Node, as it only applies to Element.
1369           Also add a non-virtual overload that takes a Node in argument and
1370           that does the isElementNode() check so that we don't need to explicitly
1371           do the check at each call site.
1372
1373         No new tests, no behavior change.
1374
1375         * editing/MarkupAccumulator.cpp:
1376         (WebCore::MarkupAccumulator::appendEndTag):
1377         (WebCore::MarkupAccumulator::shouldSelfClose):
1378         (WebCore::MarkupAccumulator::appendEndMarkup):
1379         * editing/MarkupAccumulator.h:
1380         (WebCore::MarkupAccumulator::appendEndTag):
1381         * page/PageSerializer.cpp:
1382         (WebCore::SerializerMarkupAccumulator::appendEndTag):
1383
1384 2014-09-19  Pratik Solanki  <psolanki@apple.com>
1385
1386         [iOS] ASSERTION FAILED: WTF::isMainThread() in WebCore::memoryCache() when using WebKit1
1387         https://bugs.webkit.org/show_bug.cgi?id=136962
1388         <rdar://problem/18342344>
1389
1390         Reviewed by Geoffrey Garen.
1391
1392         The disk cache monitor callback code was being executed on the main thread. This is wrong
1393         when the web thread is being used in WebKit1 on iOS. The code needs to run on the web
1394         thread. Use WebThreadRun to dispatch the block to the web thread. This works for WebKit2 as
1395         well since when web thread is not being used, WebThreadRun invokes the block directly.
1396
1397         * loader/cocoa/DiskCacheMonitorCocoa.mm:
1398         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
1399
1400 2014-09-19  Jer Noble  <jer.noble@apple.com>
1401
1402         Unreviewed build fix; pass duration into the lambda.
1403
1404         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1405         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
1406
1407 2014-09-19  Dean Jackson  <dino@apple.com>
1408
1409         Multithreaded WebGL is a bad idea - remove it
1410         https://bugs.webkit.org/show_bug.cgi?id=136964
1411         <rdar://problem/18399858>
1412
1413         Reviewed by Brent Fulgham.
1414
1415         We should not allow multithreaded GL access. Remove the
1416         feature.
1417
1418         * html/canvas/WebGLRenderingContext.cpp:
1419         (WebCore::WebGLRenderingContext::create):
1420         * page/Settings.in:
1421         * platform/graphics/GraphicsContext3D.h:
1422         (WebCore::GraphicsContext3D::Attributes::Attributes):
1423         * platform/graphics/mac/GraphicsContext3DMac.mm:
1424         (WebCore::GraphicsContext3D::GraphicsContext3D):
1425
1426 2014-09-19  Eric Carlson  <eric.carlson@apple.com>
1427
1428         [MSE][Mac] work around AVSampleBufferRenderSynchronizer early callbacks
1429         https://bugs.webkit.org/show_bug.cgi?id=136958
1430
1431         Reviewed by Jer Noble.
1432
1433         No new tests, we have been unable to come up with a test case that reproduces
1434         this issue reliably.
1435
1436         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1437         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged): Set the synchronizer
1438             time to duration when the duration time observer is called early. Add more logging.
1439
1440 2014-09-19  Benjamin Poulain  <bpoulain@apple.com>
1441
1442         CSS JIT: allocate the minimum required register count in debug
1443         https://bugs.webkit.org/show_bug.cgi?id=136933
1444
1445         Reviewed by Andreas Kling.
1446
1447         It is hard to catch bugs of minimumRegisterRequirements() because every CPU has a different
1448         number of registers available by default.
1449
1450         This patch aims at improving testing by creating artificial register pressure when running
1451         in debug. When running in debug, we no longer allocate all the available registers right away.
1452         Instead, we allocate just enough to satisfy minimumRegisterRequirements().
1453
1454         The expectation with this is that under-allocation would be detected quicker since they would
1455         crash debug builds.
1456
1457         * cssjit/RegisterAllocator.h:
1458         (WebCore::RegisterAllocator::RegisterAllocator):
1459         (WebCore::RegisterAllocator::reserveCallerSavedRegisters):
1460         (WebCore::RegisterAllocator::availableRegisterCount): Deleted.
1461         * cssjit/SelectorCompiler.cpp:
1462         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
1463
1464 2014-09-19  Benjamin Poulain  <bpoulain@apple.com>
1465
1466         Add a size check for CSSSelector
1467         https://bugs.webkit.org/show_bug.cgi?id=136882
1468
1469         Reviewed by Christophe Dumez.
1470
1471         * css/CSSSelector.cpp:
1472
1473 2014-09-19  Eva Balazsfalvi  <evab.u-szeged@partner.samsung.com>
1474
1475         REGRESSION(r173464): It broke the !ENABLE(PICTURE_SIZES) build
1476         https://bugs.webkit.org/show_bug.cgi?id=136942
1477
1478         Reviewed by Simon Fraser.
1479
1480         * html/HTMLImageElement.cpp:
1481         (WebCore::HTMLImageElement::parseAttribute):
1482
1483 2014-09-19  Simon Fraser  <simon.fraser@apple.com>
1484
1485         Provide a default argument for the most commonly used HitTestRequest variant
1486         https://bugs.webkit.org/show_bug.cgi?id=136653
1487
1488         Reviewed by Darin Adler.
1489
1490         Make the default HitTestRequest flags be ReadOnly | Active | DisallowShadowContent
1491         and change call sites using the default flags to use a HitTestRequest temporary.
1492
1493         * dom/TreeScope.cpp:
1494         (WebCore::nodeFromPoint):
1495         * editing/FrameSelection.cpp:
1496         (WebCore::FrameSelection::contains):
1497         * page/DragController.cpp:
1498         (WebCore::elementUnderMouse):
1499         * page/EventHandler.cpp:
1500         (WebCore::EventHandler::handleMouseDraggedEvent):
1501         (WebCore::EventHandler::handleMousePressEvent):
1502         * rendering/HitTestRequest.h:
1503         (WebCore::HitTestRequest::HitTestRequest):
1504
1505 2014-09-19  Chris Dumez  <cdumez@apple.com>
1506
1507         Allow DOM methods to return references instead of pointers
1508         https://bugs.webkit.org/show_bug.cgi?id=136931
1509
1510         Reviewed by Sam Weinig.
1511
1512         It is common practice in WebKit to have methods return a reference
1513         instead of a pointer if the pointer can never be null. However, this
1514         unfortunately did not work for DOM methods (functions called by JS
1515         bindings). This prevented further refactoring.
1516
1517         This patch brings support for having DOM methods to return references
1518         instead of pointers when the pointer cannot be null. The generated
1519         bindings were calling WTF::getPtr() on the pointer type returned by
1520         the implementation already (in case it was a smart pointer type).
1521         This patch leverages this by having WTF::getPtr() convert reference
1522         arguments into raw pointers.
1523
1524         This patch also updates a few DOM methods on Document and Element
1525         classes to return a reference instead of a pointer, to test the change.
1526         There are likely more DOM methods that can be updated though.
1527
1528         No new tests, no behavior change.
1529
1530         * accessibility/AccessibilityObject.cpp:
1531         (WebCore::AccessibilityObject::classList):
1532         * bindings/js/JSDOMBinding.h:
1533         (WTF::getPtr): Deleted.
1534         * dom/Document.cpp:
1535         (WebCore::Document::implementation):
1536         (WebCore::Document::webkitGetNamedFlows):
1537         (WebCore::Document::namedFlows):
1538         (WebCore::Document::setXMLVersion):
1539         (WebCore::Document::setXMLStandalone):
1540         (WebCore::Document::securityPolicy):
1541         (WebCore::Document::styleSheets):
1542         * dom/Document.h:
1543         (WebCore::Document::timing):
1544         * dom/Element.cpp:
1545         (WebCore::Element::classList):
1546         (WebCore::Element::dataset):
1547         * dom/Element.h:
1548         * html/shadow/MediaControlElements.cpp:
1549         (WebCore::MediaControlPanelElement::setPosition):
1550         (WebCore::MediaControlPanelElement::resetPosition):
1551         (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
1552         * html/track/VTTRegion.cpp:
1553         (WebCore::VTTRegion::displayLastTextTrackCueBox):
1554         (WebCore::VTTRegion::willRemoveTextTrackCueBox):
1555         * inspector/InspectorCSSAgent.cpp:
1556         (WebCore::InspectorCSSAgent::getAllStyleSheets):
1557         (WebCore::InspectorCSSAgent::getNamedFlowCollection):
1558         * page/PerformanceTiming.cpp:
1559         (WebCore::PerformanceTiming::documentTiming):
1560         * rendering/FlowThreadController.cpp:
1561         (WebCore::FlowThreadController::ensureRenderFlowThreadWithName):
1562
1563 2014-09-19  Daniel Bates  <dabates@apple.com>
1564
1565         Always assume internal SDK when building configuration Production
1566         https://bugs.webkit.org/show_bug.cgi?id=136925
1567         <rdar://problem/18362399>
1568
1569         Reviewed by Dan Bernstein.
1570
1571         As a side effect of this change we will always enable ENABLE_TOUCH_EVENTS, ENABLE_IOS_{GESTURE, TOUCH}_EVENTS,
1572         and ENABLE_XSLT when either building configuration Production or building with the Internal SDK.
1573
1574         * Configurations/Base.xcconfig:
1575
1576 2014-09-19  Chris Dumez  <cdumez@apple.com>
1577
1578         Optimize MarkupAccumulator::appendText()
1579         https://bugs.webkit.org/show_bug.cgi?id=136935
1580
1581         Reviewed by Benjamin Poulain.
1582
1583         MarkupAccumulator::appendText() was calling the generic appendNodeValue()
1584         method to append the text. appendNodeValue() supports any kind of Node and
1585         thus calls the Node::nodeValue() virtual function.
1586
1587         Since appendText() is the only caller to appendNodeValue(), this patch
1588         inlines the code in appendText() and makes it specific to Text Node, and
1589         thus more efficient. The code now calls CharacterData::data() instead of
1590         the Node::nodeValue() virtual function. This patch also updates
1591         CharacterData::data() to return a const reference to avoid copying the
1592         return value.
1593
1594         No new tests, no behavior change.
1595
1596         * dom/CharacterData.h:
1597         (WebCore::CharacterData::data):
1598         * editing/MarkupAccumulator.cpp:
1599         (WebCore::MarkupAccumulator::appendText):
1600         (WebCore::MarkupAccumulator::appendNodeValue): Deleted.
1601         * editing/MarkupAccumulator.h:
1602
1603 2014-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1604
1605         [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
1606         https://bugs.webkit.org/show_bug.cgi?id=136923
1607
1608         Reviewed by Gustavo Noronha Silva.
1609
1610         * platform/gtk/GtkDragAndDropHelper.cpp:
1611         (WebCore::GtkDragAndDropHelper::handleDragLeave): Use GMainLoopSource::scheduleAndDeleteOnDestroy().
1612
1613 2014-09-18  Roger Fong  <roger_fong@apple.com>
1614
1615         [Windows] Media tests all fail because they cannot find localized strings.
1616         
1617         * rendering/RenderThemeSafari.cpp:
1618         (WebCore::RenderThemeSafari::mediaControlsScript):
1619         Make sure to use localized strings files in RenderThemeSafari.
1620
1621 2014-09-18  Simon Fraser  <simon.fraser@apple.com>
1622
1623         Remove generator/yield terminology in RenderInline's GeneratorContext
1624         https://bugs.webkit.org/show_bug.cgi?id=119278
1625
1626         Reviewed by Sam Weinig.
1627         
1628         Get rid of the icky Generator/yield syntax used for collecting rects in RenderInline.
1629         Just replace the operator() with an explicit addRect().
1630         
1631         Also some drive-by nullptr cleanup, and removing default arguments from
1632         addChildIgnoringContinuation() calls.
1633
1634         * rendering/RenderInline.cpp:
1635         (WebCore::RenderInline::willBeDestroyed):
1636         (WebCore::RenderInline::styleDidChange):
1637         (WebCore::RenderInline::splitInlines):
1638         (WebCore::RenderInline::addChildToContinuation):
1639         (WebCore::RenderInline::generateLineBoxRects):
1640         (WebCore::RenderInline::generateCulledLineBoxRects):
1641         * rendering/RenderInline.h:
1642
1643 2014-09-18  Jeremy Jones  <jeremyj@apple.com>
1644
1645         Improve fullscreen video rotation animation.
1646         https://bugs.webkit.org/show_bug.cgi?id=136870
1647
1648         Reviewed by Simon Fraser.
1649
1650         Instead of setting the frame on the video layer, set position and bounds separately. This allows the position to be synchronized with the rest of the animation.
1651         When using a fencePort to synchronize animations, if the fence times out, pivoting around the center provides a better fallback.
1652
1653         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1654         (-[WebAVVideoLayer setVideoSublayer:]): added
1655         (-[WebAVVideoLayer videoSublayer]): added
1656         (-[WebAVVideoLayer setBounds:]):  set position and bounds insted of frame.
1657         (WebVideoFullscreenInterfaceAVKit::setupFullscreen): use setVideoSublayer
1658         * platform/ios/WebVideoFullscreenModelVideoElement.mm:
1659         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): set bounds and anchorPoint instead of frame
1660         (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): set bounds instead of frame.
1661
1662 2014-09-17  Myles C. Maxfield  <mmaxfield@apple.com>
1663
1664         Text laid out with the SVG -> OTF font converter does not have the same metrics as with the SVG font code path
1665         https://bugs.webkit.org/show_bug.cgi?id=136907
1666
1667         Reviewed by Darin Adler.
1668
1669         There are three things that are causing text laid out with the SVG -> OTF font converter to not have metrics that
1670         measure our existing SVG codepath. They are:
1671
1672         1. Creating a font with a 0 ascent or descent makes OS X think that something is wrong with the font, and take
1673         a different codepath when trying to parse ascent and descent information. This patch checks for this condition
1674         and sets the ascent/descent to 1 FUnit instead (which is generally much smaller than a pixel).
1675         2. Our SVG font codepath hardcodes a line gap of 1/10th of the font size for every font. This patch makes the
1676         font converter obey this.
1677         3. The converter was not allowing for default glyph advances as per the SVG font specification. This patch
1678         does so.
1679
1680         No new tests yet, but they will come soon! I promise!
1681
1682         * svg/SVGToOTFFontConversion.cpp:
1683         (WebCore::SVGToOTFFontConverter::appendHHEATable):
1684         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
1685
1686 2014-09-18  Daniel Bates  <dabates@apple.com>
1687
1688         REGRESSION (r168921): SVG elements may be unnecessarily rebuilt
1689         https://bugs.webkit.org/show_bug.cgi?id=136373
1690
1691         Reviewed by David Kilzer.
1692
1693         Fixes an issue where a SVG element may be unnecessarily rebuilt. In particular,
1694         it is unnecessary to rebuild a SVG element that will be removed from the document.
1695
1696         Test: svg/custom/remove-subtree-including-use-with-child-textpath-that-references-earlier-path.html
1697
1698         * svg/SVGDocumentExtensions.cpp:
1699         (WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Modified to remove a SVG element
1700         from the list of elements to be rebuilt.
1701
1702 2014-09-18  Joseph Pecoraro  <pecoraro@apple.com>
1703
1704         Unreviewed rollout r173731. Broke multiple builds.
1705
1706         * WebCore.exp.in:
1707         * inspector/InspectorController.cpp:
1708         (WebCore::InspectorController::connectFrontend):
1709         (WebCore::InspectorController::show):
1710         * inspector/InspectorController.h:
1711         * page/PageDebuggable.cpp:
1712         (WebCore::PageDebuggable::connect):
1713         * page/PageDebuggable.h:
1714         * testing/Internals.cpp:
1715         (WebCore::Internals::openDummyInspectorFrontend):
1716
1717 2014-09-18  Beth Dakin  <bdakin@apple.com>
1718
1719         ASSERT in RenderBox::instrinsicScrollbarLogicalWidth opening the inspector
1720         https://bugs.webkit.org/show_bug.cgi?id=136929
1721
1722         Reviewed by Simon Fraser.
1723
1724         This is a regression from http://trac.webkit.org/changeset/173668 
1725         This code is wrong after that change because it assumes that overflow:scroll will 
1726         always have a scrollbar. That is no longer the case. We need to check to make sure 
1727         it’s an overflow:scroll that does NOT have overflow:auto behavior.
1728
1729         * rendering/RenderBox.cpp:
1730         (WebCore::RenderBox::instrinsicScrollbarLogicalWidth):
1731
1732 2014-09-18  Joseph Pecoraro  <pecoraro@apple.com>
1733
1734         Web Inspector: Should be able to attach a debugger to a JSContext before anything is executed
1735         https://bugs.webkit.org/show_bug.cgi?id=136893
1736
1737         Reviewed by Timothy Hatcher.
1738
1739         Automatic inspection is currently disabled for web pages.
1740         This just updates the interfaces that changed.
1741
1742         * WebCore.exp.in:
1743         * inspector/InspectorController.cpp:
1744         (WebCore::InspectorController::connectFrontend):
1745         (WebCore::InspectorController::show):
1746         * inspector/InspectorController.h:
1747         * page/PageDebuggable.cpp:
1748         (WebCore::PageDebuggable::connect):
1749         * page/PageDebuggable.h:
1750         * testing/Internals.cpp:
1751         (WebCore::Internals::openDummyInspectorFrontend):
1752
1753 2014-09-18  Chris Dumez  <cdumez@apple.com>
1754
1755         Use fastHasAttribute() / fastGetAttribute() when possible
1756         https://bugs.webkit.org/show_bug.cgi?id=136900
1757
1758         Reviewed by Benjamin Poulain.
1759
1760         Use fastHasAttribute() / fastGetAttribute() when possible, that is when
1761         the attribute is not SVG-animated or the |style| attribute, to avoid
1762         synchronizing attributes unnecessarily.
1763
1764         Also avoid calling hasAttribute(xxxAttr) then getAttribute(xxxAttr) as
1765         it causes 2 linear searches. It is best to call getAttribute(xxxAttr)
1766         directly and check if it returns the nullAtom.
1767
1768         No new tests, no behavior change. Element::fastAttributeLookupAllowed()
1769         is there as a safety set for debug builds.
1770
1771         * accessibility/AccessibilityListBoxOption.cpp:
1772         (WebCore::AccessibilityListBoxOption::isEnabled):
1773         * accessibility/AccessibilityNodeObject.cpp:
1774         (WebCore::AccessibilityNodeObject::alternativeTextForWebArea):
1775         (WebCore::AccessibilityNodeObject::hierarchicalLevel):
1776         * accessibility/AccessibilityObject.cpp:
1777         (WebCore::AccessibilityObject::contentEditableAttributeIsEnabled):
1778         * dom/Document.cpp:
1779         (WebCore::Document::hasManifest):
1780         * dom/DocumentOrderedMap.cpp:
1781         (WebCore::keyMatchesLabelForAttribute):
1782         * dom/DocumentStyleSheetCollection.cpp:
1783         (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
1784         * dom/Element.cpp:
1785         (WebCore::Element::imageSourceURL):
1786         (WebCore::Element::pseudo):
1787         (WebCore::Element::spellcheckAttributeState):
1788         * editing/ApplyStyleCommand.cpp:
1789         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
1790         * editing/EditingStyle.cpp:
1791         (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
1792         (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
1793         * editing/SplitElementCommand.cpp:
1794         (WebCore::SplitElementCommand::doUnapply):
1795         * html/HTMLAnchorElement.cpp:
1796         (WebCore::HTMLAnchorElement::draggable):
1797         (WebCore::HTMLAnchorElement::sendPings):
1798         * html/HTMLAppletElement.cpp:
1799         (WebCore::HTMLAppletElement::updateWidget):
1800         * html/HTMLBodyElement.cpp:
1801         (WebCore::HTMLBodyElement::addSubresourceAttributeURLs):
1802         * html/HTMLButtonElement.cpp:
1803         (WebCore::HTMLButtonElement::value):
1804         * html/HTMLDocument.cpp:
1805         (WebCore::HTMLDocument::dir):
1806         * html/HTMLEmbedElement.cpp:
1807         (WebCore::HTMLEmbedElement::imageSourceURL):
1808         (WebCore::HTMLEmbedElement::addSubresourceAttributeURLs):
1809         * html/HTMLFieldSetElement.cpp:
1810         (WebCore::HTMLFieldSetElement::~HTMLFieldSetElement):
1811         (WebCore::updateFromControlElementsAncestorDisabledStateUnder):
1812         (WebCore::HTMLFieldSetElement::disabledAttributeChanged):
1813         (WebCore::HTMLFieldSetElement::disabledStateChanged):
1814         (WebCore::HTMLFieldSetElement::childrenChanged):
1815         (WebCore::HTMLFieldSetElement::didMoveToNewDocument):
1816         * html/HTMLFormControlElement.cpp:
1817         (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor):
1818         * html/HTMLFormElement.cpp:
1819         (WebCore::HTMLFormElement::action):
1820         * html/HTMLFrameElement.cpp:
1821         (WebCore::HTMLFrameElement::noResize):
1822         * html/HTMLFrameElementBase.cpp:
1823         (WebCore::HTMLFrameElementBase::location):
1824         * html/HTMLHRElement.cpp:
1825         (WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
1826         * html/HTMLHtmlElement.cpp:
1827         (WebCore::HTMLHtmlElement::insertedByParser):
1828         * html/HTMLImageElement.cpp:
1829         (WebCore::HTMLImageElement::altText):
1830         (WebCore::HTMLImageElement::alt):
1831         (WebCore::HTMLImageElement::draggable):
1832         (WebCore::HTMLImageElement::src):
1833         (WebCore::HTMLImageElement::addSubresourceAttributeURLs):
1834         * html/HTMLInputElement.cpp:
1835         (WebCore::HTMLInputElement::finishParsingChildren):
1836         (WebCore::HTMLInputElement::altText):
1837         (WebCore::HTMLInputElement::reset):
1838         * html/HTMLLabelElement.cpp:
1839         (WebCore::HTMLLabelElement::control):
1840         * html/HTMLLinkElement.cpp:
1841         (WebCore::HTMLLinkElement::process):
1842         (WebCore::HTMLLinkElement::rel):
1843         * html/HTMLMetaElement.cpp:
1844         (WebCore::HTMLMetaElement::content):
1845         (WebCore::HTMLMetaElement::httpEquiv):
1846         * html/HTMLObjectElement.cpp:
1847         (WebCore::HTMLObjectElement::imageSourceURL):
1848         (WebCore::HTMLObjectElement::addSubresourceAttributeURLs):
1849         * html/HTMLOptGroupElement.cpp:
1850         (WebCore::HTMLOptGroupElement::groupLabelText):
1851         * html/HTMLProgressElement.cpp:
1852         (WebCore::HTMLProgressElement::max):
1853         * html/HTMLScriptElement.cpp:
1854         (WebCore::HTMLScriptElement::sourceAttributeValue):
1855         (WebCore::HTMLScriptElement::charsetAttributeValue):
1856         (WebCore::HTMLScriptElement::languageAttributeValue):
1857         (WebCore::HTMLScriptElement::forAttributeValue):
1858         (WebCore::HTMLScriptElement::eventAttributeValue):
1859         * html/HTMLTableCellElement.cpp:
1860         (WebCore::HTMLTableCellElement::addSubresourceAttributeURLs):
1861         * html/HTMLTableElement.cpp:
1862         (WebCore::HTMLTableElement::rules):
1863         (WebCore::HTMLTableElement::summary):
1864         (WebCore::HTMLTableElement::addSubresourceAttributeURLs):
1865         * html/HTMLTableSectionElement.cpp:
1866         (WebCore::HTMLTableSectionElement::align):
1867         (WebCore::HTMLTableSectionElement::ch):
1868         (WebCore::HTMLTableSectionElement::vAlign):
1869         * html/HTMLTextAreaElement.cpp:
1870         (WebCore::HTMLTextAreaElement::maxLength):
1871         * html/SearchInputType.cpp:
1872         (WebCore::SearchInputType::searchEventsShouldBeDispatched):
1873         * loader/FormSubmission.cpp:
1874         (WebCore::FormSubmission::create):
1875         * page/Frame.cpp:
1876         (WebCore::Frame::matchLabelsAgainstElement):
1877         * page/PageSerializer.cpp:
1878         (WebCore::PageSerializer::serializeFrame):
1879         * platform/win/PasteboardWin.cpp:
1880         (WebCore::Pasteboard::writeImageToDataObject):
1881         * rendering/HitTestResult.cpp:
1882         (WebCore::HitTestResult::altDisplayString):
1883         * rendering/RenderSearchField.cpp:
1884         (WebCore::RenderSearchField::autosaveName):
1885         * rendering/RenderTableCell.cpp:
1886         (WebCore::RenderTableCell::computePreferredLogicalWidths):
1887         * rendering/svg/RenderSVGResourceClipper.cpp:
1888         (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
1889
1890 2014-09-18  Chris Dumez  <cdumez@apple.com>
1891
1892         Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
1893         https://bugs.webkit.org/show_bug.cgi?id=136902
1894
1895         Reviewed by Darin Adler.
1896
1897         Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
1898         in argument instead of a pointer as the Element can never be null.
1899
1900         No new tests, no behavior change.
1901
1902         * dom/ClassNodeList.h:
1903         (WebCore::ClassNodeList::elementMatches):
1904         * dom/DocumentOrderedMap.cpp:
1905         (WebCore::keyMatchesWindowNamedItem):
1906         (WebCore::keyMatchesDocumentNamedItem):
1907         * dom/Element.cpp:
1908         (WebCore::Element::updateNameForDocument):
1909         (WebCore::Element::updateIdForDocument):
1910         * dom/LiveNodeList.cpp:
1911         (WebCore::LiveNodeList::namedItem):
1912         * dom/LiveNodeList.h:
1913         (WebCore::CachedLiveNodeList<NodeListType>::collectionBegin):
1914         (WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
1915         (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
1916         (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
1917         * dom/NameNodeList.h:
1918         (WebCore::NameNodeList::elementMatches):
1919         * dom/TagNodeList.h:
1920         (WebCore::TagNodeList::elementMatches):
1921         (WebCore::HTMLTagNodeList::elementMatches):
1922         * html/HTMLCollection.cpp:
1923         (WebCore::isMatchingElement):
1924         * html/HTMLNameCollection.cpp:
1925         (WebCore::WindowNameCollection::elementMatchesIfNameAttributeMatch):
1926         (WebCore::WindowNameCollection::elementMatches):
1927         (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
1928         (WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
1929         (WebCore::DocumentNameCollection::elementMatches):
1930         * html/HTMLNameCollection.h:
1931         * html/LabelsNodeList.cpp:
1932         (WebCore::LabelsNodeList::elementMatches):
1933         * html/LabelsNodeList.h:
1934         * html/RadioNodeList.cpp:
1935         (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
1936         (WebCore::RadioNodeList::elementMatches):
1937         * html/RadioNodeList.h:
1938
1939 2014-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1940
1941         Remove unused methods from MediaPlayerClient
1942         https://bugs.webkit.org/show_bug.cgi?id=136884
1943
1944         Reviewed by Eric Carlson.
1945
1946         Remove unused methods from MediaPlayerClient that introduce
1947         dependencies on WebCore types.
1948
1949         * html/HTMLMediaElement.cpp:
1950         * html/HTMLMediaElement.h:
1951         * platform/graphics/MediaPlayer.h:
1952         (WebCore::MediaPlayerClient::mediaPlayerOwningDocument): Deleted.
1953         (WebCore::MediaPlayerClient::mediaPlayerHostWindow): Deleted.
1954         (WebCore::MediaPlayerClient::mediaPlayerWindowClipRect): Deleted.
1955
1956 2014-09-17  Iago Toral  <itoral@igalia.com> and Zan Dobersek  <zdobersek@igalia.com>
1957
1958         [GTK] Add Wayland support to GLContextEGL
1959         https://bugs.webkit.org/show_bug.cgi?id=136829
1960
1961         Reviewed by Martin Robinson.
1962
1963         * platform/graphics/egl/GLContextEGL.cpp:
1964         (WebCore::sharedEGLDisplay): Special-case the shared EGL display initialization
1965         for the GTK port when running under Wayland. In that case the pointer to the
1966         native wl_display object should be passed to eglGetDisplay(). If not running
1967         under Wayland we should fall back to using the shared X11 display (if support
1968         for that display system is enabled) or the EGL_DEFAULT_DISPLAY.
1969
1970 2014-09-17  Daniel Bates  <dabates@apple.com>
1971
1972         Unreviewed, rolling out r173695.
1973
1974         Broke building third-party Legacy WebKit apps; will
1975         investigate offline
1976
1977         Reverted changeset:
1978
1979         "[iOS] Make WebCore build with public iOS SDK"
1980         https://bugs.webkit.org/show_bug.cgi?id=136487
1981         http://trac.webkit.org/changeset/173695
1982
1983 2014-09-17  Roger Fong  <roger_fong@apple.com>
1984
1985         Speculative fix for a fast\dom\html-collections-named-getter failing only in Debug builds.
1986
1987         * dom/Node.cpp:
1988         (WebCore::Document::invalidateNodeListAndCollectionCaches):
1989
1990 2014-09-17  Benjamin Poulain  <bpoulain@apple.com>
1991
1992         Add parsing for :nth-child(An+B of selector)
1993         https://bugs.webkit.org/show_bug.cgi?id=136845
1994
1995         Reviewed by Antti Koivisto.
1996
1997         Add support for parsing :nth-child(of). The implementation of selector matching
1998         will be in a follow up, there are enough edge cases here already.
1999
2000         Spec here: http://dev.w3.org/csswg/selectors4/#the-nth-child-pseudo
2001
2002         Test: fast/css/parsing-css-nth-child-of.html
2003
2004         * css/CSSParser.cpp:
2005         (WebCore::CSSParser::detectFunctionTypeToken):
2006         (WebCore::CSSParser::realLex):
2007         The parser generate two new kinds of tokens:
2008         -NTHCHILDFUNCTION, matching the "nth-child" identifier.
2009         -NTHCHILDSELECTORSEPARATOR, matching the "of" keyword separating An+B from the selector list.
2010
2011         NTHCHILDFUNCTION is used to extend the new syntax only for :nth-child() and not all the "nth" functions
2012         (e.g. :nth-of-type()).
2013
2014         NTHCHILDSELECTORSEPARATOR exists for two reasons:
2015         -We must clear the "parsingMode" before parsing selectorList. If we failed to do that, the complex selectors
2016          would be parsed in NthChildMode, which has all kind of bad side effects.
2017         -The second reason is differentiacting "of" for all the other identifiers. Arguably, this could have been done
2018          in the grammar, but it is clearer this way since we already need the branches for the parsingMode.
2019
2020         * css/CSSGrammar.y.in:
2021         Those are pretty much duplicates of the existing FUNCTION rules but supporting the new syntax.
2022
2023         * css/CSSParserValues.cpp:
2024         (WebCore::selectorListMatchesPseudoElement):
2025         (WebCore::CSSParserSelector::matchesPseudoElement):
2026         Matching pseudo elements does not make much sense for those selectorList (e.g. :nth-child(2n of ::before)).
2027         Add helper function to fail parsing of those cases.
2028
2029         * css/CSSParserValues.h:
2030         * css/CSSSelector.cpp:
2031         (WebCore::CSSSelector::selectorText):
2032         * css/CSSSelector.h:
2033         (WebCore::CSSSelector::selectorList):
2034         Updated serialization code for CSS OM.
2035
2036 2014-09-17  Benjamin Poulain  <bpoulain@apple.com>
2037
2038         CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc.
2039         https://bugs.webkit.org/show_bug.cgi?id=136807
2040
2041         Reviewed by Antti Koivisto.
2042
2043         The spec defines selector lists as token separated by white space.
2044
2045         The definition of white space for CSS Selectors is:
2046         "White space in Selectors consists of the code points SPACE (U+0020),
2047         TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C)
2048         can occur in whitespace. Other space-like code points, such as EM SPACE (U+2003)
2049         and IDEOGRAPHIC SPACE (U+3000), are never part of white space."
2050
2051         The old code was only matching SPACE (U+0020) which is buggy. This patch
2052         adds support for the other caracters.
2053
2054         Tests: fast/selectors/attr-list-01.html
2055                fast/selectors/attribute-list-with-whitespace-in-selector.html
2056                fast/selectors/attribute-list-with-whitespace-in-value.html
2057
2058         * css/SelectorChecker.cpp:
2059         (WebCore::attributeValueMatches):
2060         * cssjit/SelectorCompiler.cpp:
2061         (WebCore::SelectorCompiler::constructFragments):
2062         (WebCore::SelectorCompiler::attributeValueSpaceSeparetedListContains):
2063         Add the missing checks.
2064
2065         * html/track/VTTRegion.cpp:
2066         (WebCore::VTTRegion::setRegionSettings):
2067         (WebCore::VTTRegion::parseSettingValue):
2068         * html/track/WebVTTParser.cpp:
2069         (WebCore::WebVTTParser::hasRequiredFileIdentifier):
2070         (WebCore::WebVTTParser::collectTimingsAndSettings):
2071         * html/track/WebVTTParser.h:
2072         While looking for affected code, I discovered WebVTT redefines isHTMLSpace().
2073         I cleaned that code.
2074
2075 2014-09-17  Gavin Barraclough  <baraclough@apple.com>
2076
2077         Aways have a PageThrottler (sometimes have a UserActivity::Impl)
2078         https://bugs.webkit.org/show_bug.cgi?id=136892
2079
2080         Reviewed by Geoffrey Garen.
2081
2082         Some instances of Page have a PageThrottler to track activity on the Page, and some do not.
2083         (Specifically, those created from WebPage in WK2 do, those related to WK1, SVG & inspector do not).
2084
2085         We do this for three reasons:
2086             * We do not need to take AppNap assertions on WK1.
2087             * Some Pages do not track their visibility correctly, and would always claim to be visible.
2088             * Page VisibilityState is not set until after construction, so if we instantiate
2089
2090         Creating the entire PageThrottler lazily has the drawback that we have to check for its existence at
2091         numerous points throughout the code, and we'll miss activity that occurs between the Page being created
2092         & the PageThrottler added to it (really a theoretical problem right now, since they're currently always
2093         created pretty much back to back).
2094
2095         Instead, Page should always have a PageThrottler, & instead make the UserActivity::Impl on the
2096         PageThrottler be added later.
2097
2098         * WebCore.exp.in:
2099             - createPageThrottler -> enablePageThrottler
2100         * html/HTMLMediaElement.cpp:
2101         (WebCore::HTMLMediaElement::parseAttribute):
2102             - Page::pageThrottler now returns a reference rather than a pointer
2103         * loader/FrameLoader.cpp:
2104         (WebCore::FrameLoader::started):
2105             - Page::pageThrottler now returns a reference rather than a pointer
2106         * page/Page.cpp:
2107         (WebCore::Page::Page):
2108             - instantiate PageThrottler in constructor
2109         (WebCore::Page::enablePageThrottler):
2110             - renamed from createPageThrottler, instead of creating the PageThrottler this method now
2111               instruct PageThrottler to create a UserActivity::Impl
2112         (WebCore::Page::setViewState):
2113             - m_pageThrottler is not a pointer
2114         (WebCore::Page::createPageThrottler): Deleted.
2115             - renamed to enablePageThrottler
2116         * page/Page.h:
2117         (WebCore::Page::pageThrottler):
2118             - now returns a reference
2119         * page/PageThrottler.cpp:
2120         (WebCore::PageThrottler::PageThrottler):
2121             - no longer instantiate m_activity
2122         (WebCore::PageThrottler::createUserActivity):
2123             - lazily instantiate m_activity, call updateUserActivity
2124         (WebCore::PageThrottler::updateUserActivity):
2125             - m_activity may not yet be instantiated; added early return
2126         * page/PageThrottler.h:
2127             - m_activity becomes a std::unique_ptr, added createUserActivity
2128
2129 2014-09-17  Daniel Bates  <dabates@apple.com>
2130
2131         [iOS] Make WebCore build with public iOS SDK
2132         https://bugs.webkit.org/show_bug.cgi?id=136487
2133
2134         Reviewed by David Kilzer.
2135
2136         Add headers that wrap Mac and iOS SPIs and update WebCore source files to include these
2137         headers instead of the corresponding actual SPI header(s).
2138
2139         * WebCore.vcxproj/WebCore.vcxproj:
2140         * WebCore.vcxproj/WebCore.vcxproj.filters:
2141         * WebCore.vcxproj/WebCoreCG.props:
2142         * WebCore.vcxproj/copyForwardingHeaders.cmd:
2143         * WebCore.xcodeproj/project.pbxproj:
2144         * bindings/objc/DOMInternal.mm:
2145         * bridge/objc/objc_instance.mm:
2146         * platform/audio/ios/MediaSessionManagerIOS.mm:
2147         * platform/cocoa/DisplaySleepDisablerCocoa.cpp:
2148         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
2149         * platform/graphics/SimpleFontData.h:
2150         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2151         * platform/graphics/ca/mac/PlatformCALayerMac.mm:
2152         * platform/graphics/cg/BitmapImageCG.cpp:
2153         * platform/graphics/cg/ColorCG.cpp:
2154         * platform/graphics/cg/GraphicsContextCG.cpp:
2155         * platform/graphics/cg/ImageSourceCG.cpp:
2156         * platform/graphics/cg/PDFDocumentImage.cpp:
2157         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2158         * platform/graphics/ios/FontCacheIOS.mm:
2159         * platform/graphics/ios/FontServicesIOS.mm:
2160         * platform/graphics/ios/SimpleFontDataIOS.mm:
2161         * platform/graphics/mac/FontMac.mm:
2162         * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
2163         * platform/graphics/mac/MediaPlayerProxy.h:
2164         * platform/graphics/mac/SimpleFontDataMac.mm:
2165         * platform/ios/LegacyTileCache.mm:
2166         * platform/ios/LegacyTileGrid.mm:
2167         * platform/ios/LegacyTileGridTile.mm:
2168         * platform/ios/PlatformEventFactoryIOS.mm:
2169         * platform/ios/PlatformScreenIOS.mm:
2170         * platform/ios/WebEvent.mm:
2171         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2172         * platform/ios/wak/WAKAppKitStubs.h:
2173         * platform/ios/wak/WAKView.h:
2174         * platform/ios/wak/WKGraphics.h:
2175         * platform/ios/wak/WKGraphics.mm:
2176         * platform/ios/wak/WebCoreThread.mm:
2177         * platform/network/ios/QuickLook.mm:
2178         * platform/spi/ca/CALayerSPI.h: Added.
2179         * platform/spi/ca/CATiledLayerSPI.h: Added.
2180         * platform/spi/cf/CFLocaleSPI.h: Modified to use EXTERN_C.
2181         * platform/spi/cf/CFNetworkConnectionCacheSPI.h: Ditto. Also changed header visibility from private to project.
2182         * platform/spi/cf/CFURLRequestSPI.h: Ditto. Also modified to unconditionally include header <CoreFoundation/CFBase.h>.
2183         * platform/spi/cg/CGColorTransformSPI.h: Added.
2184         * platform/spi/cg/CGContextSPI.h: Added.
2185         * platform/spi/cg/CGFloatSPI.h: Added.
2186         * platform/spi/cg/CGFontGlyphSupportSPI.h: Added.
2187         * platform/spi/cg/CGFontInfoSPI.h: Added.
2188         * platform/spi/cg/CGFontRenderingSPI.h: Added.
2189         * platform/spi/cg/CGFontUnicodeSupportSPI.h: Added.
2190         * platform/spi/cg/CGImageSPI.h: Added.
2191         * platform/spi/cg/CGSRegionSPI.h: Added.
2192         * platform/spi/cocoa/DispatchSPI.h: Added.
2193         * platform/spi/cocoa/IOPMLibSPI.h: Added.
2194         * platform/spi/cocoa/MachVMSPI.h: Added.
2195         * platform/spi/cocoa/NSFileManagerSPI.h: Added.
2196         * platform/spi/cocoa/NSGeometrySPI.h: Added.
2197         * platform/spi/cocoa/NSPointerFunctionsSPI.h: Added.
2198         * platform/spi/cocoa/dyldSPI.h: Added.
2199         * platform/spi/ios/AVPlayerControllerSPI.h: Added.
2200         * platform/spi/ios/AVPlayerViewControllerSPI.h: Added.
2201         * platform/spi/ios/AVValueTimingSPI.h: Added.
2202         * platform/spi/ios/AVVideoLayerSPI.h: Added.
2203         * platform/spi/ios/CTFontDescriptorSPI.h: Added.
2204         * platform/spi/ios/CTFontSPI.h: Added.
2205         * platform/spi/ios/CUICatalogSPI.h: Added.
2206         * platform/spi/ios/CUIStyleEffectConfigurationSPI.h: Added.
2207         * platform/spi/ios/MPAVRoutingControllerSPI.h: Added.
2208         * platform/spi/ios/MobileGestaltSPI.h: Added.
2209         * platform/spi/ios/QLPreviewConverterSPI.h: Added.
2210         * platform/spi/ios/QuickLookSPI.h: Added.
2211         * rendering/RenderThemeIOS.mm:
2212
2213 2014-09-17  Gavin Barraclough  <barraclough@apple.com>
2214
2215         DOM timer throttling for hidden plugins
2216         https://bugs.webkit.org/show_bug.cgi?id=136197
2217
2218         Reviewed by Geoff Garen & Andreas Kling.
2219
2220         For non-visible web pages we slow timers (since they can't be driving animations, etc).
2221         We should do the same for plugins.
2222
2223         There are a few steps to this:
2224             - JSPluginElementFunctions notifies DOMTimer when script interacts with a plugin.
2225             - DOMTimerFireState keeps a record of events that occur while a timer is firing.
2226             - DOMTimer::fired detects timers that interact with invisible/inaudible plugins, and flags itself for throtting.
2227             - DOMTimer::intervalClampedToMinimum sets timer intervals appropriately.
2228
2229         * bindings/js/JSPluginElementFunctions.cpp:
2230         (WebCore::pluginScriptObject):
2231             - notify DOMTimer when script interacts with a plugin.
2232         * html/HTMLPlugInElement.cpp:
2233         (WebCore::HTMLPlugInElement::isDetectable):
2234         * html/HTMLPlugInElement.h:
2235             - added isDetectable, to check for visible / audible plugins.
2236         * page/DOMTimer.cpp:
2237         (WebCore::DOMTimerFireState::DOMTimerFireState):
2238         (WebCore::DOMTimerFireState::~DOMTimerFireState):
2239             - track current DOMTimerFireState.
2240         (WebCore::DOMTimer::DOMTimer):
2241             - initialize m_throttleState.
2242         (WebCore::DOMTimer::scriptDidInteractWithPlugin):
2243             - if interaction with a plugin occurs while a timer is firing, record on the DOMTimerFireState.
2244         (WebCore::DOMTimer::fired):
2245             - set DOMTimerFireState, and update m_throttleState accordingly.
2246         (WebCore::DOMTimer::updateTimerIntervalIfNecessary):
2247             - remove redundant check of maxTimerNestingLevel (covered by intervalClampedToMinimum).
2248         (WebCore::DOMTimer::intervalClampedToMinimum):
2249             - Also take m_throttleState into account when throttling.
2250         * page/DOMTimer.h:
2251             - added scriptDidInteractWithPlugin, m_throttleState.
2252         * platform/audio/AudioHardwareListener.h:
2253             - enum -> enum class.
2254         * plugins/PluginViewBase.h:
2255         (WebCore::PluginViewBase::audioHardwareActivity):
2256             - expose audioHardwareActivity on PluginViewBase (previously available in subclass).
2257
2258 2014-09-16  Gavin Barraclough  <baraclough@apple.com>
2259
2260         Exclude page visibility from PageThrottler's hysteresis
2261         https://bugs.webkit.org/show_bug.cgi?id=136866
2262
2263         Reviewed by Geoff Garen.
2264
2265         Including visibility in the hysteresis mechanism has the effect of prolonging the visually
2266         idle timeout, and causing the page hide event to be run at foreground priority. Neither of
2267         these are particularly desirable. Instead separate visibility from the rest of the page
2268         activities we track (and apply hysteresis to), and feed this directly into determination
2269         of the UserActivity state.
2270
2271         * page/PageThrottler.cpp:
2272         (WebCore::PageThrottler::PageThrottler):
2273             - when the PageThrottler is instantiated call updateUserActivity to set initial UserActivity.
2274         (WebCore::PageThrottler::incrementActivityCount):
2275             - simplified - when m_activityCount becomes non-zero, start m_hysteresis.
2276         (WebCore::PageThrottler::decrementActivityCount):
2277             - simplified - when m_activityCount becomes zero, stop m_hysteresis.
2278         (WebCore::PageThrottler::updateUserActivity):
2279             - end the UserActivity (allow AppNap) if visually idle and no page activity is taking place.
2280         (WebCore::PageThrottler::setViewState):
2281             - when the visually idle state changed call updateUserActivity to update the UserActivity.
2282         (WebCore::PageThrottler::started):
2283         (WebCore::PageThrottler::stopped):
2284             - when the hysteresis state changed call updateUserActivity to update the UserActivity.
2285         (WebCore::PageThrottler::updateHysteresis): Deleted.
2286             - removed: simplified the hysteresis trigger, we now incorporate visually idle state in updateUserActivity.
2287         * page/PageThrottler.h:
2288             - removed updateHysteresis, added updateUserActivity.
2289         * platform/HysteresisActivity.h:
2290         (WebCore::HysteresisActivity::state):
2291             - determine the curent state of the HysteresisActivity - started, waiting, or stopped.
2292
2293 2014-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2294
2295         [GTK] Fix runtime critical warnings when writing to the clipboard after r173687
2296         https://bugs.webkit.org/show_bug.cgi?id=136891
2297
2298         Reviewed by Philippe Normand.
2299
2300         * platform/gtk/PasteboardHelper.cpp:
2301         (WebCore::PasteboardHelper::writeClipboardContents): Check passed
2302         callback is not null before trying to ref/unref it since
2303         g_closure_ref/unref are not null safe.
2304
2305 2014-09-17  Zan Dobersek  <zdobersek@igalia.com>
2306
2307         [GTK] Add a helper function for display system deduction
2308         https://bugs.webkit.org/show_bug.cgi?id=136849
2309
2310         Reviewed by Martin Robinson.
2311
2312         getDisplaySystemType() is a helper function that checks the type of the
2313         default GdkDisplay object and initializes a static variable to the
2314         corresponding value. It then returns the value of that variable.
2315
2316         When building with the GTK+2 API (still the case with the GTK+2 plugin
2317         process) we default to X11.
2318
2319         The function is declared and implemented in GtkUtilities files.
2320
2321         * platform/gtk/GtkUtilities.cpp:
2322         (WebCore::widgetIsOnscreenToplevelWindow):
2323         (WebCore::getDisplaySystemType):
2324         * platform/gtk/GtkUtilities.h:
2325
2326 2014-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2327
2328         filterRootById accidentally clears inAdjacentChain flag
2329         https://bugs.webkit.org/show_bug.cgi?id=136851
2330
2331         Reviewed by Benjamin Poulain.
2332
2333         Test: fast/selectors/filter-root-node-with-selector-contains-adjacents.html
2334
2335         * dom/SelectorQuery.cpp:
2336         (WebCore::filterRootById):
2337
2338 2014-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2339
2340         [GTK] Fix layering violations in PasteboardGtk
2341         https://bugs.webkit.org/show_bug.cgi?id=136802
2342
2343         Reviewed by Darin Adler.
2344
2345         Refactor the Pasteboard code moving the WebCore parts to the Editor.
2346
2347         * PlatformGTK.cmake: Add new file to compilation.
2348         * editing/Editor.cpp:
2349         (WebCore::Editor::performCutOrCopy):
2350         (WebCore::Editor::copyImage):
2351         * editing/Editor.h:
2352         * editing/gtk/EditorGtk.cpp: Added.
2353         (WebCore::createFragmentFromPasteBoardData):
2354         (WebCore::Editor::pasteWithPasteboard):
2355         (WebCore::getImageAndURLForElement):
2356         (WebCore::Editor::writeImageToPasteboard):
2357         (WebCore::Editor::writeSelectionToPasteboard):
2358         * page/DragController.cpp:
2359         (WebCore::DragController::startDrag):
2360         * page/gtk/DragControllerGtk.cpp:
2361         (WebCore::DragController::declareAndWriteDragImage):
2362         * platform/Pasteboard.h:
2363         * platform/gtk/DataObjectGtk.cpp: Remove range member, the caller
2364         should call setText() + setMarkup() intead.
2365         (WebCore::DataObjectGtk::setText):
2366         (WebCore::DataObjectGtk::setMarkup):
2367         (WebCore::DataObjectGtk::clearText):
2368         (WebCore::DataObjectGtk::clearMarkup):
2369         (WebCore::DataObjectGtk::clearAllExceptFilenames):
2370         * platform/gtk/DataObjectGtk.h:
2371         (WebCore::DataObjectGtk::hasText):
2372         (WebCore::DataObjectGtk::hasMarkup):
2373         (WebCore::DataObjectGtk::clearImage):
2374         (WebCore::DataObjectGtk::text):
2375         (WebCore::DataObjectGtk::markup):
2376         (WebCore::DataObjectGtk::setRange): Deleted.
2377         * platform/gtk/GtkDragAndDropHelper.h:
2378         * platform/gtk/PasteboardGtk.cpp:
2379         (WebCore::PasteboardImage::PasteboardImage):
2380         (WebCore::PasteboardImage::~PasteboardImage):
2381         (WebCore::Pasteboard::write):
2382         (WebCore::Pasteboard::writeSelection): Deleted.
2383         (WebCore::getURLForImageElement): Deleted.
2384         (WebCore::Pasteboard::writeImage): Deleted.
2385         (WebCore::Pasteboard::documentFragment): Deleted.
2386         * platform/gtk/PasteboardHelper.cpp:
2387         (WebCore::displayFromFrame): Deleted.
2388         (WebCore::PasteboardHelper::getPrimarySelectionClipboard): Deleted.
2389         * platform/gtk/PasteboardHelper.h:
2390
2391 2014-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2392
2393         DragData should not depend on Clipboard, DocumentFragment, and Document
2394         https://bugs.webkit.org/show_bug.cgi?id=21358
2395
2396         Reviewed by Darin Adler.
2397
2398         Refactor DragData to not depend on Frame, DocumentFragment,
2399         Document and Range. DragData::asFragment() has been moved to
2400         DragController and implemented in the platform specific file.
2401         DragData methods using Frame has been reworked in Mac to not use
2402         Frame, since all other ports were ignoreing the frame parameter.
2403
2404         * page/DragController.cpp:
2405         (WebCore::DragController::documentFragmentFromDragData): Make it
2406         a static member to be able to use createFragmentFromDragData().
2407         (WebCore::DragController::performDragOperation): Update to
2408         DragData API changes.
2409         (WebCore::DragController::dispatchTextInputEventFor): Ditto.
2410         (WebCore::DragController::concludeEditDrag): Ditto.
2411         (WebCore::documentFragmentFromDragData): Deleted.
2412         * page/DragController.h:
2413         * page/efl/DragControllerEfl.cpp:
2414         (WebCore::DragController::createFragmentFromDragData): Move
2415         DragData::asFragment() implementation here.
2416         * page/gtk/DragControllerGtk.cpp:
2417         (WebCore::DragController::dragOperation):
2418         (WebCore::DragController::createFragmentFromDragData): Ditto.
2419         * page/mac/DragControllerMac.mm:
2420         (WebCore::DragController::dragOperation):
2421         (WebCore::DragController::createFragmentFromDragData): Ditto.
2422         * page/win/DragControllerWin.cpp:
2423         (WebCore::DragController::createFragmentFromDragData): Ditto.
2424         * platform/DragData.h:
2425         * platform/efl/DragDataEfl.cpp:
2426         (WebCore::DragData::asPlainText): Remove Frame parameter.
2427         (WebCore::DragData::containsURL): Ditto.
2428         (WebCore::DragData::asURL): Ditto.
2429         (WebCore::DragData::asFragment): Deleted.
2430         * platform/gtk/DragDataGtk.cpp:
2431         (WebCore::DragData::asPlainText): Remove Frame parameter.
2432         (WebCore::DragData::containsCompatibleContent):
2433         (WebCore::DragData::containsURL): Ditto.
2434         (WebCore::DragData::asURL): Ditto.
2435         (WebCore::DragData::asFragment): Deleted.
2436         * platform/mac/DragDataMac.mm:
2437         (WebCore::DragData::asPlainText): Same implementation as the
2438         Editor.
2439         (WebCore::DragData::containsURL): Remove Frame parameter.
2440         (WebCore::DragData::asURL): Use URLByCanonicalizingURL() instead
2441         of using the Editor client.
2442         (WebCore::DragData::asFragment): Deleted.
2443         * platform/win/DragDataWin.cpp:
2444         (WebCore::DragData::containsURL): Remove Frame parameter.
2445         (WebCore::DragData::asURL): Ditto.
2446         (WebCore::DragData::asPlainText): Ditto.
2447         (WebCore::DragData::containsCompatibleContent):
2448         (WebCore::DragData::asFragment): Deleted.
2449
2450 2014-09-16  Chris Dumez  <cdumez@apple.com>
2451
2452         Rename Node::childNode(index) to traverseToChildAt(index) for clarity
2453         https://bugs.webkit.org/show_bug.cgi?id=136825
2454
2455         Reviewed by Benjamin Poulain.
2456
2457         Rename Node::childNode(index) to traverseToChildAt(index) to make it
2458         clearer that the method is actually traversing the children and thus
2459         potentially expensive.
2460
2461         This patch also avoids calling traverseToChildAt() in a couple of
2462         easily avoidable cases.
2463
2464         No new tests, no behavior change.
2465
2466         * WebCore.exp.in:
2467         * WebCore.order:
2468         Remove symbol for ContainerNode::childNode() as it was renamed. It does
2469         not seem we need to expose ContainerNode::traverseToChildAt().
2470
2471         * accessibility/AccessibilityObject.cpp:
2472         (WebCore::AccessibilityObject::stringForVisiblePositionRange):
2473         (WebCore::AccessibilityObject::lengthForVisiblePositionRange):
2474         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2475         (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
2476         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2477         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]):
2478         Mechanical renaming.
2479
2480         * dom/ContainerNode.cpp:
2481         (WebCore::ContainerNode::traverseToChildAt):
2482         (WebCore::ContainerNode::childNode): Deleted.
2483         * dom/ContainerNode.h:
2484         (WebCore::Node::traverseToChildAt):
2485         (WebCore::Node::childNode): Deleted.
2486         * dom/Node.h:
2487         - Rename Node / ContainerNode's childNode(index) to
2488           traverseToChildAt(index) to make it clear that it is actually
2489           traversing the children and thus potentially expensive.
2490         - Clean up the implementation of ContainerNode::traverseToChildAt()
2491           to avoid the use of an extra |i| variable.
2492
2493         * dom/Position.cpp:
2494         (WebCore::Position::computeNodeBeforePosition):
2495         Avoid calling traverseToChildAt(-1). Relying on the unsigned argument
2496         wrapping and the method returning null in this case is a bit obscure
2497         and causes unnecessary traversal of all children.
2498
2499         (WebCore::Position::computeNodeAfterPosition):
2500         (WebCore::Position::previous):
2501         (WebCore::Position::next):
2502         Mechanical renaming and update variable names to stop using
2503         abbreviations as per coding style.
2504
2505         * dom/PositionIterator.h:
2506         (WebCore::PositionIterator::PositionIterator):
2507         * dom/Range.cpp:
2508         (WebCore::Range::insertNode):
2509         (WebCore::Range::checkNodeWOffset):
2510         (WebCore::Range::firstNode):
2511         (WebCore::Range::pastLastNode):
2512         * dom/RangeBoundaryPoint.h:
2513         (WebCore::RangeBoundaryPoint::set):
2514         * editing/BreakBlockquoteCommand.cpp:
2515         (WebCore::BreakBlockquoteCommand::doApply):
2516         * editing/CompositeEditCommand.cpp:
2517         (WebCore::CompositeEditCommand::removeChildrenInRange):
2518         * editing/DeleteSelectionCommand.cpp:
2519         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
2520         * editing/InsertParagraphSeparatorCommand.cpp:
2521         (WebCore::InsertParagraphSeparatorCommand::doApply):
2522         * editing/TextIterator.cpp:
2523         (WebCore::nextInPreOrderCrossingShadowBoundaries):
2524         (WebCore::TextIterator::node):
2525         (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
2526         * editing/VisibleUnits.cpp:
2527         (WebCore::nextLinePosition):
2528         * editing/cocoa/HTMLConverter.mm:
2529         (WebCore::editingAttributedStringFromRange):
2530         Mechanical renaming.
2531
2532         * inspector/DOMPatchSupport.cpp:
2533         (WebCore::DOMPatchSupport::innerPatchChildren):
2534         Iterate over children while incrementing the |i| variable to avoid
2535         calling traverseToChildAt(index) repeatedly and thus traversing the
2536         children from the beginning every time.
2537
2538 2014-09-16  Joseph Pecoraro  <pecoraro@apple.com>
2539
2540         Web Inspector: Reduce a bit of churn setting initial remote inspection state
2541         https://bugs.webkit.org/show_bug.cgi?id=136875
2542
2543         Reviewed by Timothy Hatcher.
2544
2545         * bindings/js/JSDOMGlobalObject.cpp:
2546         (WebCore::JSDOMGlobalObject::finishCreation):
2547         We no longer need to toggle this state.
2548
2549 2014-09-16  Enrica Casucci  <enrica@apple.com>
2550
2551         Should have an editing behavior specific for IOS.
2552         https://bugs.webkit.org/show_bug.cgi?id=136876
2553
2554         Reviewed by Sam Weinig.
2555
2556         This patch introduces a new editing behavior type to be able
2557         to perform editing tasks that are specific to iOS.
2558         All the existing EditingBehavior methods return the same boolean
2559         value for for Mac and iOS. A new one has been introduced to support
2560         a specific behavior in the DeleteSelectionCommand.
2561
2562         * editing/DeleteSelectionCommand.cpp:
2563         (WebCore::DeleteSelectionCommand::doApply):
2564         * editing/EditingBehavior.h:
2565         (WebCore::EditingBehavior::shouldConsiderSelectionAsDirectional):
2566         (WebCore::EditingBehavior::shouldCenterAlignWhenSelectionIsRevealed):
2567         (WebCore::EditingBehavior::shouldToggleStyleBasedOnStartOfSelection):
2568         (WebCore::EditingBehavior::shouldAlwaysGrowSelectionWhenExtendingToBoundary):
2569         (WebCore::EditingBehavior::shouldSelectOnContextualMenuClick):
2570         (WebCore::EditingBehavior::shouldExtendSelectionByWordOrLineAcrossCaret):
2571         (WebCore::EditingBehavior::shouldRebalanceWhiteSpacesInSecureField):
2572         * editing/EditingBehaviorTypes.h:
2573         * editing/FrameSelection.cpp:
2574         (WebCore::FrameSelection::positionForPlatform):
2575         * page/Settings.cpp:
2576         (WebCore::editingBehaviorTypeForPlatform):
2577         * testing/InternalSettings.cpp:
2578         (WebCore::InternalSettings::setEditingBehavior):
2579
2580 2014-09-16  Commit Queue  <commit-queue@webkit.org>
2581
2582         Unreviewed, rolling out r173670.
2583         https://bugs.webkit.org/show_bug.cgi?id=136871
2584
2585         Creates layering violation (Requested by enrica on #webkit).
2586
2587         Reverted changeset:
2588
2589         "Move HTMLConverter from editing/cocoa to platform/cocoa."
2590         https://bugs.webkit.org/show_bug.cgi?id=136474
2591         http://trac.webkit.org/changeset/173670
2592
2593 2014-09-16  Eric Carlson  <eric.carlson@apple.com>
2594
2595         [Mac] MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput doesn't work with rotated movies
2596         https://bugs.webkit.org/show_bug.cgi?id=136872
2597
2598         Reviewed by Tim Horton.
2599
2600         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2601         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Add logging.
2602         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): Apply the video track
2603             preferred transform.
2604
2605 2014-09-16  Enrica Casucci  <enrica@apple.com>
2606
2607         Move HTMLConverter from editing/cocoa to platform/cocoa.
2608         https://bugs.webkit.org/show_bug.cgi?id=136474
2609
2610         Reviewed by Benjamin Poulain.
2611
2612         This is a platform specific class and it belongs to the platform folder.
2613
2614         * WebCore.xcodeproj/project.pbxproj:
2615         * editing/cocoa: Removed.
2616         * editing/cocoa/HTMLConverter.h: Removed.
2617         * editing/cocoa/HTMLConverter.mm: Removed.
2618         * platform/cocoa/HTMLConverter.h: Copied from editing/cocoa/HTMLConverter.h.
2619         * platform/cocoa/HTMLConverter.mm: Copied from editing/cocoa/HTMLConverter.mm.
2620
2621 2014-09-16  Enrica Casucci  <enrica@apple.com>
2622
2623         Remove PLATFORM(IOS) from WebCore/editing (Part 3).
2624         https://bugs.webkit.org/show_bug.cgi?id=136474
2625
2626         Reviewed by Benjamin Poulain.
2627
2628         This is the updated version of the patch that was landed in r173340.
2629         This patch removes the use of PLATFORM(IOS) from TextAffinity.h
2630         and removes the assumption that EAffinity values match NSSelectionAffinity
2631         values. It also removes the includes in TextAffinity.h, creating the need to
2632         include explicitly the files when necessary.
2633
2634         * editing/TextAffinity.h:
2635         (kit): Deleted.
2636         (core): Deleted.
2637         * editing/cocoa/HTMLConverter.mm:
2638         * page/mac/WebCoreFrameView.h:
2639
2640 2014-09-16  Beth Dakin  <bdakin@apple.com>
2641
2642         overflow:scroll should not leave space for a scroll corner with overlay scrollbars
2643         https://bugs.webkit.org/show_bug.cgi?id=136861
2644
2645         Reviewed by Sam Weinig.
2646
2647         overflow:scroll should behave like overflow:auto when the scrollbar will render as 
2648         an overlay scrollbar.
2649
2650         Re-name hasAutoVerticalScrollbar()/Horizontal to 
2651         hasVerticalScrollbarWithAutoBehavior()/Horizontal, and return true for 
2652         overflow:scroll scrollbars that will render as overlay scrollbars.
2653         * rendering/RenderBox.cpp:
2654         (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior):
2655         (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior):
2656         * rendering/RenderBox.h:
2657         (WebCore::RenderBox::scrollsOverflowX):
2658         (WebCore::RenderBox::scrollsOverflowY):
2659         (WebCore::RenderBox::hasAutoVerticalScrollbar): Deleted.
2660         (WebCore::RenderBox::hasAutoHorizontalScrollbar): Deleted.
2661
2662         Re-name overflowRequiresScrollbar() to styleRequiresScrollbar() and also re-name 
2663         overflowDefinesAutomaticScrollbar() to styleDefinesAutomaticScrollbar(), and make         
2664         these functions take into account the fact that overflow:scroll should act like 
2665         overflow:auto when the scrollbar will render as an overlay scrollbar.
2666         * rendering/RenderLayer.cpp:
2667         (WebCore::styleRequiresScrollbar):
2668         (WebCore::styleDefinesAutomaticScrollbar):
2669         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
2670         (WebCore::RenderLayer::calculateClipRects):
2671
2672 2014-09-16  peavo@outlook.com  <peavo@outlook.com>
2673
2674         [Curl] Sometimes incomplete or empty content can be loaded from cache.
2675         https://bugs.webkit.org/show_bug.cgi?id=136855
2676
2677         Reviewed by Alex Christensen.
2678
2679         Sometimes, when two requests with the same url are started at the same time,
2680         there is a possibility of loading incomplete or empty content from the cache.
2681         This happens because the method CurlCacheEntry::isLoading() is returning the wrong status
2682         in the time period between the headers are received, and the content data is received.
2683         This can be fixed by using a flag for the load status, instead of checking whether
2684         the content file is open. 
2685
2686         * platform/network/curl/CurlCacheEntry.cpp:
2687         (WebCore::CurlCacheEntry::CurlCacheEntry): Initialize loading flag.
2688         (WebCore::CurlCacheEntry::isLoading): Return loading flag.
2689         (WebCore::CurlCacheEntry::didFail): Call new method to set loading flag.
2690         (WebCore::CurlCacheEntry::didFinishLoading): Ditto.
2691         (WebCore::CurlCacheEntry::setIsLoading): Added new method to set loading flag.
2692         * platform/network/curl/CurlCacheEntry.h: Added loading flag and new method to set it.
2693         * platform/network/curl/CurlCacheManager.cpp:
2694         (WebCore::CurlCacheManager::didReceiveResponse): Call new method to set loading flag.
2695
2696 2014-09-16  Chris Dumez  <cdumez@apple.com>
2697
2698         Rename Node::nodeIndex() to computeNodeIndex() for clarity
2699         https://bugs.webkit.org/show_bug.cgi?id=136826
2700
2701         Reviewed by Benjamin Poulain.
2702
2703         Rename Node::nodeIndex() to computeNodeIndex() to make it clear that
2704         index is being computed and that calling this method is potentially
2705         expensive.
2706
2707         No new tests, no behavior change.
2708
2709         * WebCore.exp.in:
2710         * WebCore.order:
2711         Rename exported symbol for Node::nodeIndex() as well.
2712
2713         * dom/Document.cpp:
2714         (WebCore::Document::caretRangeFromPoint):
2715         * dom/Node.cpp:
2716         (WebCore::Node::computeNodeIndex):
2717         (WebCore::Node::nodeIndex): Deleted.
2718         * dom/Node.h:
2719         * dom/NodeWithIndex.h:
2720         (WebCore::NodeWithIndex::index):
2721         Clean up implementation to reduce the scope of the Node variable and
2722         to follow coding style (variable naming, spacing, star placement).
2723
2724         * dom/Position.cpp:
2725         (WebCore::Position::computeOffsetInContainerNode):
2726         (WebCore::Position::previous):
2727         (WebCore::Position::next):
2728         (WebCore::Position::upstream):
2729         (WebCore::Position::downstream):
2730         * dom/Position.h:
2731         (WebCore::positionInParentBeforeNode):
2732         (WebCore::positionInParentAfterNode):
2733         * dom/Range.cpp:
2734         (WebCore::Range::compareNode):
2735         (WebCore::Range::intersectsNode):
2736         (WebCore::Range::processContents):
2737         (WebCore::Range::insertNode):
2738         (WebCore::Range::setStartAfter):
2739         (WebCore::Range::setEndBefore):
2740         (WebCore::Range::setEndAfter):
2741         (WebCore::Range::setStartBefore):
2742         * dom/RangeBoundaryPoint.h:
2743         (WebCore::RangeBoundaryPoint::ensureOffsetIsValid):
2744         * editing/ApplyStyleCommand.cpp:
2745         (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
2746         (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
2747         * editing/DeleteSelectionCommand.cpp:
2748         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
2749         * editing/Editor.cpp:
2750         (WebCore::Editor::avoidIntersectionWithDeleteButtonController):
2751         * editing/FrameSelection.cpp:
2752         (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected):
2753         * editing/ReplaceSelectionCommand.cpp:
2754         (WebCore::ReplaceSelectionCommand::doApply):
2755         * editing/TextIterator.cpp:
2756         (WebCore::TextIterator::range):
2757         (WebCore::SimplifiedBackwardsTextIterator::handleReplacedElement):
2758         (WebCore::SimplifiedBackwardsTextIterator::handleNonTextNode):
2759         * editing/htmlediting.cpp:
2760         (WebCore::updatePositionForNodeRemoval):
2761         * html/HTMLTextFormControlElement.cpp:
2762         (WebCore::setContainerAndOffsetForRange):
2763         * page/DOMSelection.cpp:
2764         (WebCore::DOMSelection::getRangeAt):
2765         (WebCore::DOMSelection::containsNode):
2766         (WebCore::DOMSelection::shadowAdjustedOffset):
2767         * rendering/RenderBlock.cpp:
2768         (WebCore::positionForPointRespectingEditingBoundaries):
2769         * rendering/RenderTreeAsText.cpp:
2770         (WebCore::nodePosition):
2771
2772 2014-09-16  Jer Noble  <jer.noble@apple.com>
2773
2774         Videos with controls enabled never receive 'dragstart' events.
2775         https://bugs.webkit.org/show_bug.cgi?id=136837
2776
2777         Reviewed by Eric Carlson.
2778
2779         Fixes a crash regression introduced by r173631. Node::contains() has an interesting property of returning false
2780         if `this` is NULL. Rather than depending on this behavior, explicitly NULL-check state.source and bail early.
2781
2782         * page/DragController.cpp:
2783         (WebCore::DragController::startDrag):
2784
2785 2014-09-16  Csaba Osztrogonác  <ossy@webkit.org>
2786
2787         URTBF after r173659.
2788
2789         After r173659 convertToIntLength() is used only inside ENABLE(DASHBOARD_SUPPORT), so it
2790         became unused function and caused build failure if ENABLE(DASHBOARD_SUPPORT) is false.
2791
2792         Source/WebCore/css/StyleResolver.cpp:1471:15: error: 'WebCore::Length WebCore::convertToIntLength(const WebCore::CSSPrimitiveValue*, const WebCore::CSSToLengthConversionData&)'
2793         defined but not used [-Werror=unused-function] cc1plus: all warnings being treated as errors
2794
2795         * css/StyleResolver.cpp: Missing ENABLE(DASHBOARD_SUPPORT) guard added.
2796
2797 2014-09-14  Darin Adler  <darin@apple.com>
2798
2799         Scroll snap properties don't handle inherit and initial propertly.
2800         https://bugs.webkit.org/show_bug.cgi?id=136643
2801
2802         Reviewed by Beth Dakin.
2803
2804         Restructured scroll snap code both to handle inherit and initial, and to reduce the
2805         total code size a bit, fixing a few minor bugs along the way. Updated the regression
2806         tests to cover the new parts.
2807
2808         * css/CSSComputedStyleDeclaration.cpp:
2809         (WebCore::addValuesForNamedGridLinesAtIndex): Use a modern for loop.
2810         (WebCore::scrollSnapDestination): Changed to take a LengthSize. Also streamlined.
2811         (WebCore::scrollSnapPoints): Changed to to take a ScrollSnapPoints. Also streamlined and
2812         added code to handle the "uses elements" case; serialize that as an identifier, not the
2813         string "elements", fixing a minor bug.
2814         (WebCore::scrollSnapCoordinates): Changed to take a Vector<LengthSize>. Also streamlined
2815         and added code to handle the empty vector case; serialize that as an identifier, not the
2816         string "none", fixing a minor bug.
2817         (WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword): Use nullptr.
2818         (WebCore::counterToCSSValue): Use nullptr.
2819         (WebCore::ComputedStyleExtractor::styledNode): Use nullptr.
2820         (WebCore::ComputedStyleExtractor::propertyValue): Use nullptr. Moved CSS_SCROLL_SNAP
2821         to a more appropriate section of the switch statement. Made it just call through to
2822         the functions above in a more straightforward way.
2823         (WebCore::CSSComputedStyleDeclaration::getPropertyValue): Reversed logic to use early
2824         return and to call emptyString.
2825         (WebCore::CSSComputedStyleDeclaration::item): Use emptyString.
2826         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand): Use nullptr.
2827         (WebCore::CSSComputedStyleDeclaration::parentRule): Use nullptr.
2828         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Use nullptr.
2829         (WebCore::CSSComputedStyleDeclaration::getPropertyPriority): Use emptyString.
2830         (WebCore::CSSComputedStyleDeclaration::getPropertyShorthand): Use emptyString.
2831
2832         * css/DeprecatedStyleBuilder.cpp:
2833         (WebCore::ApplyPropertyMarqueeIncrement::applyValue): Use the switch statement for the
2834         invalid value as well as for the valid values, rather than a separate if statement.
2835         Call convertToLength directly rather than through a StyleResolver static member function.
2836
2837         * css/PropertySetCSSStyleDeclaration.cpp:
2838         (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue): Fixed a formatting mistake.
2839
2840         * css/StyleResolver.cpp:
2841         (WebCore::convertToIntLength): Made this function local to this file instead of a
2842         static member function.
2843         (WebCore::convertToFloatLength): Ditto.
2844         (WebCore::StyleResolver::parseSnapCoordinate): Added. Used to keep snap point parsing
2845         code small.
2846         (WebCore::StyleResolver::parseSnapCoordinatePair): Ditto.
2847         (WebCore::StyleResolver::parseSnapPoints): Added. Parses an entire snap points property.
2848         (WebCore::StyleResolver::applyProperty): Removed various bits of redundant code that
2849         were not using the primitiveValue value already in a local variable. Added the
2850         HANDLE_INHERIT_AND_INITIAL to all the scroll snap properties and updated since the
2851         RenderStyle structure now more closely matches the CSS properties.
2852
2853         * css/StyleResolver.h: Updated for above changes, and removed a redundant "private:".
2854
2855         * page/scrolling/AxisScrollSnapOffsets.cpp:
2856         (WebCore::appendChildSnapOffsets): Use auto& instead of SnapCoordinate since that type
2857         is now gone. Updated since coordinates are now LengthSize.
2858         (WebCore::updateFromStyle): Changed to take a reference instead of a pointer and
2859         also to fetch the data from RenderStyle in a new way that more closely matches the
2860         CSS properties.
2861         (WebCore::updateSnapOffsetsForScrollableArea): Ditto. Also moved some memory allocation
2862         inside if statements so we don't wastefully allocate and destroy.
2863
2864         * rendering/style/RenderStyle.cpp: Added an include of StyleScrollSnapPoints.h now
2865         that the header doesn't include them. Moved the conditional includes out of the main
2866         include paragraph (even though I don't think conditional includes are usually a good
2867         idea).
2868         (WebCore::RenderStyle::initialScrollSnapPointsX): Added.
2869         (WebCore::RenderStyle::initialScrollSnapPointsY): Added.
2870         (WebCore::RenderStyle::initialScrollSnapDestination): Added.
2871         (WebCore::RenderStyle::initialScrollSnapCoordinates): Added.
2872         (WebCore::RenderStyle::scrollSnapPointsX): Added.
2873         (WebCore::RenderStyle::scrollSnapPointsY): Added.
2874         (WebCore::RenderStyle::scrollSnapDestination): Added.
2875         (WebCore::RenderStyle::scrollSnapCoordinates): Added.
2876         (WebCore::RenderStyle::setScrollSnapPointsX): Added.
2877         (WebCore::RenderStyle::setScrollSnapPointsY): Added.
2878         (WebCore::RenderStyle::setScrollSnapDestination): Added.
2879         (WebCore::RenderStyle::setScrollSnapCoordinates): Added.
2880
2881         * rendering/style/RenderStyle.h: Replaced the include of StyleScrollSnapPoints.h with
2882         a forward declaration of ScrollSnapPoints. Removed getters and setters for the old
2883         style properties and replaced them with new ones that match the CSS properties more
2884         closely. Tweaked formatting a bit. Added initial value functions for the the scroll snap
2885         properties.
2886
2887         * rendering/style/StyleRareNonInheritedData.cpp: Added include of StyleScrollSnapPoints.h
2888         now that RenderStyle.h doesn't include it.
2889         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated since
2890         m_scrollSnapType is now unsigned instead of ScrollSnapType.
2891
2892         * rendering/style/StyleRareNonInheritedData.h: Fixed type of m_scrollSnapType to be
2893         unsigned instead of ScrollSnapType. This should have been causing problems on Windows,
2894         but I think we got lucky and had no detectable problems.
2895
2896         * rendering/style/StyleScrollSnapPoints.cpp:
2897         (WebCore::ScrollSnapPoints::ScrollSnapPoints): Added.
2898         (WebCore::operator==): Added overloads for both ScrollSnapPoints and also for
2899         StyleScrollSnapPoints; using a free function for both since both have public data.
2900         (WebCore::defaultScrollSnapDestination): Added, replaces a static member function.
2901         (WebCore::StyleScrollSnapPoints::StyleScrollSnapPoints): Updated both the default
2902         constructor and the copy constructor for the new design.
2903
2904         * rendering/style/StyleScrollSnapPoints.h: Added a ScrollSnapPoints struct for the
2905         type of the snap-points-x and snap-points-y CSS properties. Changed the data members
2906         of StyleScrollSnapPoints to match the various CSS properties rather than breaking
2907         out all the data into separate data members.
2908         (WebCore::StyleScrollSnapPoints::defaultRepeatOffset): Deleted. Replaced by the
2909         default constructor for ScrollSnapPoints.
2910         (WebCore::StyleScrollSnapPoints::defaultDestinationOffset): Deleted. Replaced by
2911         a function inside the .cpp file.
2912
2913 2014-09-16  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2914
2915         [GStreamer] http/tests/media/video-auth.html is failing
2916         https://bugs.webkit.org/show_bug.cgi?id=126619
2917
2918         Reviewed by Philippe Normand.
2919
2920         Test: http/tests/media/video-auth-cors.html
2921
2922         Use stored credentials when retrieving videos following image loading behavior
2923         (i.e. stored credentials are always used except when in cors anonymous mode),
2924         except that requesting credentials from user remains disabled for cross-origin requests.
2925
2926         Patch is covered by http/tests/media/video-auth.html.
2927
2928         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2929         (CachedResourceStreamingClient::CachedResourceStreamingClient): Enable using stored credentials except when using cors anonymous mode.
2930
2931 2014-09-16  Jinho Bang  <jinho.bang@samsung.com>
2932
2933         Add version of drawFocusIfNeeded that take a Path2D parameter.
2934         https://bugs.webkit.org/show_bug.cgi?id=136846
2935
2936         Reviewed by Dirk Schulze.
2937
2938         Tests: fast/canvas/draw-focus-if-needed-with-path.html
2939
2940         * html/canvas/CanvasRenderingContext2D.cpp:
2941         (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):
2942         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
2943         * html/canvas/CanvasRenderingContext2D.h:
2944         * html/canvas/CanvasRenderingContext2D.idl:
2945
2946 2014-09-15  Iago Toral  <itoral@igalia.com> and Zan Dobersek  <zdobersek@igalia.com>
2947
2948         [GTK] Add WaylandDisplay
2949         https://bugs.webkit.org/show_bug.cgi?id=136216
2950
2951         Reviewed by Martin Robinson.
2952
2953         Add the WaylandDisplay class. This class is used in the LayerTreeHostGtk,
2954         in the WebProcess, and controls the connection to the nested Wayland
2955         compositor in the UIProcess. Only one instance of the class is used in the
2956         WebProcess, accessible via the static WaylandDisplay::instance() method.
2957
2958         The WaylandDisplay constructor performs the EGL initialization while also
2959         querying the Wayland register, resulting in initializing client-side objects
2960         that can interact with the wl_compositor and wl_webkitgtk interfaces
2961         implemented in the nested Wayland compositor. The single class instance is
2962         only deemed properly initialized if it picked up the Wayland interface objects
2963         and has properly acquired the EGL display and config.
2964
2965         WaylandDisplay::createSurface() is called by the LayerTreeHostGtk during
2966         its own initialization. The method creates a new wl_surface object via the
2967         wl_compositor interface and a new wl_egl_window object that's based on that
2968         surface. For the wl_egl_window object, we fall back to a width or height of 1
2969         in case the passed-in value for either is 0. This avoids problems in Mesa
2970         where widths or heights of 0 are not supported.
2971
2972         We associate the created surface with the passed-in widget ID, as provided
2973         by LayerTreeHostGtk, via the wl_webkitgtk interface. This enables proper
2974         mapping of Wayland surfaces and the GtkWidgets in the UIProcess and makes
2975         it possible for the nested Wayland compositor to correctly determine which
2976         GtkWidget has to be redrawn after some surface has been committed.
2977
2978         WaylandDisplay::createSharingGLContext() creates a new GLContextEGL object
2979         that's to be used as a sharing context. The method creates a new surface
2980         via the wl_compositor interface and uses it to create a dummy native EGL
2981         window that's 1x1px in size. The GLContextEGL object is then created
2982         through the static GLContextEGL::createWindowContext() method.
2983
2984         * PlatformGTK.cmake:
2985         * platform/graphics/wayland/WaylandDisplay.cpp: Added.
2986         (WebCore::WaylandDisplay::globalCallback):
2987         (WebCore::WaylandDisplay::globalRemoveCallback):
2988         (WebCore::WaylandDisplay::instance):
2989         (WebCore::WaylandDisplay::WaylandDisplay):
2990         (WebCore::WaylandDisplay::createSurface):
2991         (WebCore::WaylandDisplay::createSharingGLContext):
2992         * platform/graphics/wayland/WaylandDisplay.h: Added.
2993         (WebCore::WaylandDisplay::nativeDisplay):
2994         (WebCore::WaylandDisplay::eglDisplay):
2995         * platform/graphics/wayland/WaylandSurface.cpp:
2996         (WebCore::WaylandSurface::~WaylandSurface): Assert that the WaylandDisplay
2997         instance is present before going on to destroy the surface resources.
2998
2999 2014-09-15  Chris Dumez  <cdumez@apple.com>
3000
3001         Rename LiveNodeLists / HTMLCollections's nodeMatches() to elementMatches()
3002         https://bugs.webkit.org/show_bug.cgi?id=136844
3003
3004         Reviewed by Sam Weinig.
3005
3006         Rename LiveNodeLists / HTMLCollections's nodeMatches() to elementMatches()
3007         for clarity as the argument is an Element.
3008
3009         No new tests, no behavior change.
3010
3011         * dom/ClassNodeList.h:
3012         (WebCore::ClassNodeList::elementMatches):
3013         (WebCore::ClassNodeList::nodeMatches): Deleted.
3014         * dom/DocumentOrderedMap.cpp:
3015         (WebCore::keyMatchesWindowNamedItem):
3016         (WebCore::keyMatchesDocumentNamedItem):
3017         * dom/Element.cpp:
3018         (WebCore::Element::updateNameForDocument):
3019         (WebCore::Element::updateIdForDocument):
3020         * dom/LiveNodeList.cpp:
3021         (WebCore::LiveNodeList::namedItem):
3022         * dom/LiveNodeList.h:
3023         (WebCore::CachedLiveNodeList<NodeListType>::collectionBegin):
3024         (WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
3025         (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
3026         (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
3027         * dom/NameNodeList.h:
3028         (WebCore::NameNodeList::elementMatches):
3029         (WebCore::NameNodeList::nodeMatches): Deleted.
3030         * dom/TagNodeList.h:
3031         (WebCore::TagNodeList::elementMatches):
3032         (WebCore::HTMLTagNodeList::elementMatches):
3033         (WebCore::TagNodeList::nodeMatches): Deleted.
3034         (WebCore::HTMLTagNodeList::nodeMatches): Deleted.
3035         * html/HTMLCollection.cpp:
3036         (WebCore::isMatchingElement):
3037         * html/HTMLNameCollection.cpp:
3038         (WebCore::WindowNameCollection::elementMatchesIfNameAttributeMatch):
3039         (WebCore::WindowNameCollection::elementMatches):
3040         (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
3041         (WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
3042         (WebCore::DocumentNameCollection::elementMatches):
3043         (WebCore::WindowNameCollection::nodeMatchesIfNameAttributeMatch): Deleted.
3044         (WebCore::WindowNameCollection::nodeMatches): Deleted.
3045         (WebCore::DocumentNameCollection::nodeMatchesIfIdAttributeMatch): Deleted.
3046         (WebCore::DocumentNameCollection::nodeMatchesIfNameAttributeMatch): Deleted.
3047         (WebCore::DocumentNameCollection::nodeMatches): Deleted.
3048         * html/HTMLNameCollection.h:
3049         * html/LabelsNodeList.cpp:
3050         (WebCore::LabelsNodeList::elementMatches):
3051         (WebCore::LabelsNodeList::nodeMatches): Deleted.
3052         * html/LabelsNodeList.h:
3053         * html/RadioNodeList.cpp:
3054         (WebCore::RadioNodeList::elementMatches):
3055         (WebCore::RadioNodeList::nodeMatches): Deleted.
3056         * html/RadioNodeList.h:
3057
3058 2014-09-15  Chris Dumez  <cdumez@apple.com>
3059
3060         Use an AtomicString as key for caching ClassNodeList objects
3061         https://bugs.webkit.org/show_bug.cgi?id=136830
3062
3063         Reviewed by Benjamin Poulain.
3064
3065         Use an AtomicString as key for caching ClassNodeList objects instead of
3066         a String. ClassNodeList is the only type using a String instead of an
3067         AtomicString as key in the cache HashTable. This brings some
3068         complexity.
3069
3070         I believe this was done to avoid unnecessarily atomizing the String,
3071         for performance reasons. However, at the moment, the String gets
3072         atomized anyway when constructing the ClassNodeList object. This is
3073         because the ClassNodeList::m_classNames member is of SpaceSplitString
3074         type and the SpaceSplitString constructor takes an AtomicString in
3075         argument.
3076
3077         Using an AtomicString to cache ClassNodeLists simplifies the code quite
3078         a bit and decreases the size of NodeListsNodeData as well.
3079
3080         Test: fast/dom/getElementsByClassName/conflict-tag-name.html
3081
3082         * WebCore.order:
3083         Remove symbol corresponding to addCacheWithName() as it was removed.
3084
3085         * dom/ClassNodeList.cpp:
3086         (WebCore::ClassNodeList::~ClassNodeList):
3087         Update the constructor to take an AtomicString in argument instead of
3088         a String, for clarity. The String gets atomized when initializing
3089         m_classNames anyway.
3090
3091         (WebCore::ClassNodeList::ClassNodeList):
3092         Call removeCacheWithAtomicName() instead of removeCacheWithName() now
3093         that m_originalClassNames is an AtomicString.
3094
3095         * dom/ClassNodeList.h:
3096         Use AtomicString instead of String type for classNames, in both the
3097         constructor argument and the m_originalClassNames data member.
3098
3099         * dom/ContainerNode.cpp:
3100         (WebCore::ContainerNode::getElementsByClassName):
3101         Call addCacheWithAtomicName() instead of addCacheWithName() now that
3102         addCacheWithName() has been removed.
3103
3104         * dom/Node.cpp:
3105         (WebCore::NodeListsNodeData::invalidateCaches):
3106         Stop invalidating m_nameCaches as this HashMap no longer exists.
3107
3108         * dom/NodeRareData.h:
3109         (WebCore::NodeListsNodeData::NodeListCacheMapEntryHash::hash):
3110         (WebCore::NodeListsNodeData::NodeListCacheMapEntryHash::equal):
3111         (WebCore::NodeListsNodeData::isEmpty):
3112         (WebCore::NodeListsNodeData::adoptDocument):
3113         (WebCore::NodeListsNodeData::namedNodeListKey):
3114         (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList):
3115         (WebCore::NodeListsNodeData::addCacheWithName): Deleted.
3116         (WebCore::NodeListsNodeData::removeCacheWithName): Deleted.
3117         - Drop addCacheWithName() / removeCacheWithName() now that no NodeList
3118           uses a String as HashMap key.
3119         - Drop m_nameCaches now that ClassNodeLists are cached in
3120           m_atomicNameCaches instead.
3121         - Remove StringType template parameter and hardcode AtomicString
3122           instead.
3123
3124 2014-09-15  Chris Dumez  <cdumez@apple.com>
3125
3126         Return early in SelectorChecker::checkOne() if selector.isAttributeSelector() is true
3127         https://bugs.webkit.org/show_bug.cgi?id=136838
3128
3129         Reviewed by Benjamin Poulain.
3130
3131         Return early in SelectorChecker::checkOne() if selector.isAttributeSelector()
3132         is true and the selector matched. Previously, we were only returning early if
3133         the selector did not match and we were falling through if it did. This means
3134         that we ended up doing the 2 if() checks below in the method unnecessarily:
3135         - selector.m_match == CSSSelector::PseudoClass
3136         - selector.m_match == CSSSelector::PseudoElement
3137
3138         No new tests, no behavior change.
3139
3140         * css/SelectorChecker.cpp:
3141         (WebCore::SelectorChecker::checkOne):
3142
3143 2014-09-15  Chris Dumez  <cdumez@apple.com>
3144
3145         Un-inline the Node constructor
3146         https://bugs.webkit.org/show_bug.cgi?id=136842
3147
3148         Reviewed by Benjamin Poulain.
3149
3150         Un-inline the Node constructor as it does not seem to impact
3151         performance, based on my testing:
3152         http://dromaeo.com/?id=226992,226998
3153
3154         This reduces the stripped binary size by ~4Kb.
3155
3156         No new tests, no behavior change.
3157
3158         * dom/Document.h:
3159         (WebCore::Node::Node): Deleted.
3160         * dom/Node.cpp:
3161         (WebCore::Node::Node):
3162
3163 2014-09-15  Shivakumar JM  <shiva.jm@samsung.com>
3164
3165         Web Core: Websocket state should be set to closed in didReceiveMessage call back.
3166         https://bugs.webkit.org/show_bug.cgi?id=136219
3167
3168         Reviewed by Alexey Proskuryakov.
3169
3170         Set the Websocket state to closed in didReceiveMessage call back.
3171
3172         Test: http/tests/websocket/tests/hybi/error-event-ready-state.html
3173
3174         * Modules/websockets/WebSocket.cpp:
3175         (WebCore::WebSocket::didReceiveMessageError):
3176
3177 2014-09-15  Jon Honeycutt  <jhoneycutt@apple.com>
3178
3179         Naming clean-up.
3180
3181         Rubber-stamped by Andy Estes.
3182
3183         * html/HTMLFormElement.cpp:
3184         (WebCore::HTMLFormElement::requestAutocomplete):
3185         (WebCore::HTMLFormElement::finishRequestAutocomplete):
3186         Remove superfluous "AutocompleteResult".
3187
3188         * html/HTMLFormElement.h:
3189         Ditto.
3190
3191 2014-09-15  Alexey Proskuryakov  <ap@apple.com>
3192
3193         Crash when logging in to optionshouse.com
3194         https://bugs.webkit.org/show_bug.cgi?id=136834
3195
3196         Reviewed by Anders Carlsson.
3197
3198         No test, because I couldn't make one. I don't have a way to reproduce first-hand.
3199
3200         * platform/network/cf/SocketStreamHandleCFNet.cpp:
3201         (WebCore::SocketStreamHandle::readStreamCallback):
3202         (WebCore::SocketStreamHandle::writeStreamCallback):
3203
3204 2014-09-15  Jer Noble  <jer.noble@apple.com>
3205
3206         Unreviewed build fix for 32-bit builds.
3207
3208         Make casts from unsigned long long -> size_t explicit, rather than implicit. Also
3209         make CARingBuffer be protected by USING_MEDIA_TOOLBOX so ports without that flag
3210         won't try to compile unused code.
3211
3212         * platform/audio/mac/CARingBuffer.cpp:
3213         (WebCore::CARingBuffer::fetch):
3214         * platform/audio/mac/CARingBuffer.h:
3215         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3216         (WebCore::AudioSourceProviderAVFObjC::provideInput):
3217
3218 2014-09-15  Jer Noble  <jer.noble@apple.com>
3219
3220         Unreviewed logic fix from r173631. Logic for includeShadowDOM was reversed.
3221
3222         * page/DragController.cpp:
3223         (WebCore::DragController::startDrag):
3224
3225 2014-09-15  Jer Noble  <jer.noble@apple.com>
3226
3227         Videos with controls enabled never receive 'dragstart' events.
3228         https://bugs.webkit.org/show_bug.cgi?id=136837
3229
3230         Reviewed by Simon Fraser.
3231
3232         When initiating a drag, the DragController checks whether the hit-tested element at a
3233         drag location is a child of the drag source, and bails if early if that is not the case.
3234         For a <video> element with controls, the hit-tested element is an element within the
3235         <video> element's Shadow DOM. Because the DragController uses a method which does not
3236         take Shadow DOM into account when determining a child-parent relationship, this test fails
3237         and all drag operations fail as well.
3238
3239         For <video> elements only, when testing whether the drag source is an ancestor of the
3240         hit-tested element, use containsIncludingShadowDOM() instead of contains(). To ensure that
3241         the controls are still usable when a drag listener is active on a <video> element, mark
3242         the controls as a draggable element, but simply call preventDefault() in the controls'
3243         'dragstart' handler, ensuring the timeline and volume controls are themselves still draggable.
3244
3245         * Modules/mediacontrols/mediaControlsApple.css:
3246         (audio::-webkit-media-controls-panel):
3247         * Modules/mediacontrols/mediaControlsApple.js:
3248         (Controller.prototype.createControls):
3249         (Controller.prototype.handlePanelDragStart):
3250         * page/DragController.cpp:
3251         (WebCore::DragController::startDrag):
3252
3253 2014-09-15  Roger Fong  <roger_fong@apple.com>
3254
3255         Unreviewed. Add an unimplemented case to handle CSSPropertyWebkitInitialLetter so we don't get an assertion failure.
3256
3257         * css/SVGCSSStyleSelector.cpp:
3258         (WebCore::StyleResolver::applySVGProperty):
3259
3260 2014-09-15  Jer Noble  <jer.noble@apple.com>
3261
3262         [Mac] Support audioSourceProvider() in MediaPlayerPrivateAVFoundationObjC
3263         https://bugs.webkit.org/show_bug.cgi?id=135042
3264
3265         Reviewed by Eric Carlson.
3266
3267         Add support for AudioSourceProvider in MediaPlayerPrivateAVFoundationObjC, thereby
3268         supporting MediaElementAudioSourceNode.
3269
3270         Import the CARingBuffer from CoreAudio sample code, making the necessary modifications
3271         for WebKit style and coding conventions. The threading assumptions for this class are
3272         that there will be a single writer thread and a single reader thread.
3273
3274         * platform/audio/mac/CARingBuffer.cpp: Added.
3275         (WebCore::CARingBuffer::create): Create a unique_ptr.
3276         (WebCore::CARingBuffer::CARingBuffer): Simple constructor.
3277         (WebCore::CARingBuffer::~CARingBuffer): Simple destructor.
3278         (WebCore::CARingBuffer::allocate): Initialize the buffers and time bounds structures.
3279         (WebCore::CARingBuffer::deallocate): Destroy same.
3280         (WebCore::ZeroRange): Static utility method.
3281         (WebCore::StoreABL): Ditto.
3282         (WebCore::FetchABL): Ditto.
3283         (WebCore::ZeroABL): Ditto.
3284         (WebCore::CARingBuffer::store): Store the passed in buffer in the ring buffer, wrapping
3285             if necessary.
3286         (WebCore::CARingBuffer::setTimeBounds): Set the new time bounds by incrementing the
3287             bounds index locally, filling in the new values, then atomically incrementing the
3288             reader-visible index.
3289         (WebCore::CARingBuffer::getTimeBounds): Get the new time bounds by masking the time
3290             bounds index, and using it as an offset to the time bounds array. Protect against
3291             CPU starvation on the reading thread by checking the index against the stored
3292             index in the array entry. This check will fail if the writing thread has wrapped
3293             more than the size of the array.
3294         (WebCore::CARingBuffer::clipTimeBounds): Clamp the passed values to the available bounds.
3295         (WebCore::CARingBuffer::startFrame): Simple accessor.
3296         (WebCore::CARingBuffer::endFrame): Ditto.
3297         (WebCore::CARingBuffer::fetch): Read an audio buffer list from the ring buffer, possbily
3298             wrapping around to the start of the ring buffer.
3299         * platform/audio/mac/CARingBuffer.h: Added.
3300         (WebCore::CARingBuffer::numberOfChannels): Simple accessor.
3301         (WebCore::CARingBuffer::frameOffset): Ditto.
3302         (WebCore::CARingBuffer::TimeBounds::TimeBounds): Struct holding the start and end frame values.
3303
3304         Add an implementation of AudioSourceProvider, using AVAudioMix and MTAudioProcessingTap
3305         to tap an AVPlayerItem's audio output and feed it to a MediaElementAudioSourceNode.
3306
3307         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h: Added.
3308         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: Added.
3309         (WebCore::AudioSourceProviderAVFObjC::create): Simple factory.
3310         (WebCore::AudioSourceProviderAVFObjC::AudioSourceProviderAVFObjC): Simple constructor.
3311         (WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC): Simple destructor.
3312         (WebCore::AudioSourceProviderAVFObjC::provideInput): Push audio into the ring buffer.
3313         (WebCore::AudioSourceProviderAVFObjC::setClient): Call destroyMix()/createMix() as appropriate.
3314         (WebCore::AudioSourceProviderAVFObjC::setPlayerItem): Ditto.
3315         (WebCore::AudioSourceProviderAVFObjC::destroyMix): Detach and destroy the AVAudioMix and tap.
3316         (WebCore::AudioSourceProviderAVFObjC::createMix): Set up the AVAudioMix and tap and attach to
3317             the AVPlayerItem.
3318         (WebCore::AudioSourceProviderAVFObjC::initCallback): Pass to class method.
3319         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback): Ditto.
3320         (WebCore::AudioSourceProviderAVFObjC::prepareCallback): Ditto.
3321         (WebCore::AudioSourceProviderAVFObjC::unprepareCallback): Ditto.
3322         (WebCore::AudioSourceProviderAVFObjC::processCallback): Ditto.
3323         (WebCore::AudioSourceProviderAVFObjC::init): Set up the storage pointer for the tap.
3324         (WebCore::AudioSourceProviderAVFObjC::finalize): No-op.
3325         (WebCore::operator==): Compare two AudioStreamBasicDescription objects.
3326         (WebCore::operator!=): Ditto.
3327         (WebCore::AudioSourceProviderAVFObjC::prepare): Create an AudioCoverter object if necessary,
3328             create the ring buffer, and notify the client of format changes.
3329         (WebCore::AudioSourceProviderAVFObjC::unprepare): Destroy same.
3330         (WebCore::AudioSourceProviderAVFObjC::process): Copy samples out of the ring buffer,
3331             format converting them if necessary. Mute original audio.
3332
3333         Create the AudioSourceProviderAVFObjC object and notify it when the current AVPlayerItem changes.
3334
3335         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3336         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3337         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
3338         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
3339         (WebCore::MediaPlayerPrivateAVFoundationObjC::audioSourceProvider):
3340
3341         Enable SOFT_LINK_MAY_FAIL on the Mac platform.
3342
3343         * platform/mac/SoftLinking.h:
3344
3345         Add new files to the project.
3346
3347         * WebCore.xcodeproj/project.pbxproj:
3348
3349 2014-09-15  Chris Dumez  <cdumez@apple.com>
3350
3351         Avoid redundant isElementNode() checks in Traversal<HTML*Element> / Traversal<SVG*Element>
3352         https://bugs.webkit.org/show_bug.cgi?id=136719
3353
3354         Reviewed by Darin Adler.
3355
3356         Avoid redundant isElementNode() checks in Traversal<HTML*Element> /
3357         Traversal<SVG*Element>.  We used to iterate through Elements, and then
3358         call isElementOfType<HTML*Element>()  on each Element. This made sense
3359         because hasTagName() used to be defined on Element. However, after
3360         http://trac.webkit.org/changeset/165699, hasTagName() is now defined on
3361         Node for HTMLQualifiedName / SVGQualifiedName arguments.
3362
3363         Node::hasTagName(HTMLQualifiedName) basically does the following check
3364         "isHTMLElement() &&  toHTMLElement(*this).hasTagName(tagName)". As a
3365         consequence, doing an isElementNode() check is now redundant as
3366         isHTMLElement() is defined on Node.
3367
3368         This patch adds a template parameter to isElementOfType() so that it can
3369         take any type in argument (particulaly Node, Element, HTMLElement,
3370         SVGElement, MathMLElement), not just an Element. I had to add an
3371         ElementTypeCastTraits struct to support partial specialization as C++
3372         does not support partial specialization of template functions.
3373         This patch also updates Traversal<ElementType> so that the methods use
3374         NodeTraversal internally instead of Traversal<ElementType>. As a result,
3375         we now iterate over Nodes (not Elements) and call the new
3376         isElementOfType<ElementType>(Node) helpers (which are efficient after
3377         r165699).
3378
3379         Before the patch, the code ended up doing the following checks for
3380         Traversal<HTML*element>:
3381         node.isElementNode() && toElement(node).isHTMLElement()
3382             && toHTMLElement(node).hasTagName(HTMLNames::fooTag)
3383
3384         After the patch, the code only does:
3385         node.isHTMLElement()
3386             && toHTMLElement(node).hasTagName(HTMLNames::fooTag)
3387
3388         No new tests, no behavior change.
3389
3390         * dom/Element.h:
3391         (WebCore::Element>):
3392         (WebCore::isElementOfType):
3393         Add template parameter to isElementOfType() function so that it can