Need to check if some HTML child elements are HTMLUnknownElement
https://bugs.webkit.org/show_bug.cgi?id=120297

Reviewed by Andreas Kling.

Source/WebCore:

Test: fast/media/media-disable-crash.html

* dom/make_names.pl:
(printConstructorInterior): Added additional comments about the
wrapperOnlyIfMediaIsAvailable feature.
(printTypeHelpers): Added an isHTMLUnknownElement check to the check helper
functions for tags with the wrapperOnlyIfMediaIsAvailable feature.
(printWrapperFunctions): Instead of redoing the media player check and the
settings check, and possibly making a wrapper of the wrong type, call
isHTMUnknownElement, guaranteeing that the wrapper will match the element
it is wrapping.

* html/HTMLElement.h: Move HTMLElementTypeHelpers.h to the bottom of the
file so that functions from that file can be use the HTMLElement class and
other things defined in this file.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::paused): Added an assertion that made the regression
test reliably assert, rather than intermittently (for me, non-reproducibly) crash.

LayoutTests:

Based on a test written by Zan Dobersek <zdobersek@igalia.com>.

* fast/media/media-disable-crash-expected.txt: Added.
* fast/media/media-disable-crash.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156953 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r156952.
http://trac.webkit.org/changeset/156952
https://bugs.webkit.org/show_bug.cgi?id=122381

Made svg/custom/large-image-pattern-crash.html assert
(Requested by ap on #webkit).

* rendering/InlineBox.cpp:
(WebCore::InlineBox::paint):
* rendering/InlineBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations):
(WebCore::InlineFlowBox::paintMask):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/PaintInfo.h:
(WebCore::PaintInfo::shouldPaintWithinRoot):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paint):
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::paintMask):
* rendering/RenderBox.h:
* rendering/RenderElement.h:
* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::paintBoxDecorations):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paint):
* rendering/RenderLineBreak.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::paint):
* rendering/RenderObject.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::paintBoxDecorations):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorders):
(WebCore::RenderTableCell::paintBackgroundsBehindCell):
(WebCore::RenderTableCell::paintBoxDecorations):
* rendering/RenderTableCol.h:
* rendering/RenderText.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::paint):
(WebCore::RenderView::paintBoxDecorations):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::paintEllipsisBox):
(WebCore::RootInlineBox::paintCustomHighlight):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::paint):
* rendering/svg/RenderSVGGradientStop.h:
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paintReplaced):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintSelectionBackground):
(WebCore::SVGInlineTextBox::paint):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::renderSubtreeToImageBuffer):
* rendering/svg/SVGRenderingContext.h:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::rendererClipChild):
* svg/SVGUseElement.h:
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Have run-javascriptcore-tests run JS LayoutTests using run-jsc-stress-tests so that it runs in parallel
https://bugs.webkit.org/show_bug.cgi?id=122376

Tools: 

Reviewed by Mark Hahnenberg.

* Scripts/jsc-stress-test-helpers/layout-test-helper: Added.
* Scripts/run-javascriptcore-tests:
(printThingsFound):
* Scripts/run-jsc-stress-tests:

LayoutTests: 

Reviewed by Mark Hahnenberg.
        
Add a yaml file describing which directories contain JS LayoutTests. run-jsc-stress-tests
will use this file.

* jsc-layout-tests.yaml: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Attempt to fix the Lion build.

* Configurations/WebKit2.xcconfig:
Try unexporting one of the weak symbols for now. If this succeeds, I'll add the rest.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2: Another attempt at fixing the Lion build.

* Configurations/WebKit2.xcconfig:

Tools: Don't filter the weak symbols.

* Scripts/check-for-weak-vtables-and-externals:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, fix tests on older Rubies.

* Scripts/run-jsc-stress-tests:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add the rest of the std::function weak symbols in an attempt to fix the Lion build.

* Configurations/WebKit2.xcconfig:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156959 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix cut and paste errors.

* Configurations/WebKit2.xcconfig:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156960 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add *CSS* prefix to FontValue to generate toCSSFontValue()
https://bugs.webkit.org/show_bug.cgi?id=122201

Reviewed by Darin Adler.

*CSS* prefix needs to be added to FontValue class in order to generate toCSSFontValue().
static_cast<FontValue*> is changed with toCSSFontValue() by this change.

No new tests, no behavior changes.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSFontValue.cpp: Renamed from Source/WebCore/css/FontValue.cpp.
(WebCore::CSSFontValue::customCSSText):
(WebCore::CSSFontValue::equals):
* css/CSSFontValue.h: Renamed from Source/WebCore/css/FontValue.h.
(WebCore::CSSFontValue::create):
(WebCore::CSSFontValue::CSSFontValue):
* css/CSSParser.cpp:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Layout Test for selecting text ignoring region content
https://bugs.webkit.org/show_bug.cgi?id=122353

Reviewed by Darin Adler.

Add new reftests for selecting text in texts wrapping a region, where
the region content is ignored. It compares the behavior (highlighted
text and selected content) in regions and absolute positions.

Absolute positioned elements do not fill the gaps on the right during
the selection, unlike regular elements. This is the reason why some
regular elements are floated in order to avoid such problems in the
reftests.

Provided layout tests for different writing models.

* fast/regions/resources/region-style.css: New CSS classes required for these tests.
* fast/regions/selection/selecting-text-ignoring-region-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-horiz-bt-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-lr-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-lr.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-rl-expected.html: Added.
* fast/regions/selection/selecting-text-ignoring-region-vert-rl.html: Added.
* fast/regions/selection/selecting-text-ignoring-region.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Test the waters and begin using lambdas
https://bugs.webkit.org/show_bug.cgi?id=121809

Reviewed by Andreas Kling.

Source/WebCore:

Use lambdas instead of static functions and function objects.

* css/MediaQuery.cpp:
(WebCore::MediaQuery::MediaQuery):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::deliverAllMutations):
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu):

Source/WTF:

* wtf/ListDump.h:
(WTF::sortedListDump):
Use std::less instead of a custom lessThan function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Cut down on use of String::number
https://bugs.webkit.org/show_bug.cgi?id=122382

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

* API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject::putByIndex): Use Identifier::from instead of calling
String::number and creating an identifier from that. Can save creating and then
destroying a string if an identifier already exists.
* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertySlotByIndex): Ditto.
(JSC::Arguments::getOwnPropertyNames): Ditto.
(JSC::Arguments::putByIndex): Ditto.
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::::getOwnPropertyNames): Ditto.
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertyNames): Ditto.

Source/WebCore:

* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCSSText): Use StringBuilder::appendNumber,
instead of creating a string and then appending it.
(WebCore::CSSRadialGradientValue::customCSSText): Ditto.
* css/CSSParser.cpp:
(WebCore::CSSParser::createKeyframe): Ditto.
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::createDeletionUI): Use ASCII literals instead of
converting numeric constants to strings at runtime with String::number.
(WebCore::DeleteButtonController::show): Ditto.
* svg/SVGNumberList.cpp:
(WebCore::SVGNumberList::valueAsString): Use StringBuilder::appendNumber.
* svg/SVGPointList.cpp:
(WebCore::SVGPointList::valueAsString): Ditto.
* svg/SVGRect.h: Ditto.

Source/WebKit2:

* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::dumpChangedLayers): Use StringBuilder::appendNumber.

Source/WTF:

* wtf/DateMath.cpp:
(WTF::appendTwoDigitNumber): Added. Replaces twoDigitStringFromNumber, which returned a
String and also allocated a temporary string for any number 10 or higher.
(WTF::makeRFC2822DateString): Updated to use the new function.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add AtomicString::number and use it
https://bugs.webkit.org/show_bug.cgi?id=122384

Reviewed by Anders Carlsson.

Source/WebCore:

* css/CSSGrammar.y.in: Use AtomicString::number instead of String::number since
we are creating an AtomicString. This can save a memory allocation if the string
happens to already be in the atomic string table.
* dom/Element.cpp:
(WebCore::Element::setIntegralAttribute): Ditto.
(WebCore::Element::setUnsignedIntegralAttribute): Ditto.
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply): Ditto.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::insertedInto): Use setIntegralAttribute instead of
a local homegrown equivalent.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::setHeight): Ditto.
(WebCore::HTMLCanvasElement::setWidth): Ditto.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setTabIndex): Ditto.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setHeight): Ditto.
(WebCore::HTMLImageElement::setWidth): Ditto.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setMaxLength): Ditto.
(WebCore::HTMLInputElement::setSize): Same, but setUnsignedIntegralAttribute.
(WebCore::HTMLInputElement::setHeight): Ditto.
(WebCore::HTMLInputElement::setWidth): Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerSetSize): Ditto.
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::setMin): More of the same.
(WebCore::HTMLMeterElement::setMax): Ditto.
(WebCore::HTMLMeterElement::setValue): Ditto.
(WebCore::HTMLMeterElement::setLow): Ditto.
(WebCore::HTMLMeterElement::setHigh): Ditto.
(WebCore::HTMLMeterElement::setOptimum): Ditto.
* html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::setStart): Ditto.
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::setValue): Ditto.
(WebCore::HTMLProgressElement::setMax): Ditto.
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::parseAttribute): Ditto.
(WebCore::HTMLSelectElement::setSize): Ditto.
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::setColSpan): Ditto.
(WebCore::HTMLTableCellElement::setRowSpan): Ditto.
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::setSpan): Ditto.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setMaxLength): Ditto.
(WebCore::HTMLTextAreaElement::setCols): Ditto.
(WebCore::HTMLTextAreaElement::setRows): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineElement::setDuration): Ditto.

Source/WTF:

* wtf/text/AtomicString.cpp:
(WTF::AtomicString::number): Added.
* wtf/text/AtomicString.h: Ditto.

* wtf/text/IntegerToStringConversion.h: Simplify includes, renamed ConversionTrait to
IntegerToStringConversionTrait. Changed String version to use String since we no longer
need to use PassRefPtr to efficiently handle return values. Replaced UnsignedIntegerTrait
with std::make_unsigned. Added AtomicString support. Use nullptr instead of 0.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK build fix after r156946. The framePolicyFunction is an attribute
on the WebKitWebPolicyDecisionPrivate object.

* webkit/webkitwebpolicydecision.cpp:
(webkit_web_policy_decision_use):
(webkit_web_policy_decision_ignore):
(webkit_web_policy_decision_download):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) since it's required now
https://bugs.webkit.org/show_bug.cgi?id=122387

Reviewed by Anders Carlsson.

Source/WebCore:

* html/canvas/CanvasStyle.h: Take out conditionals.

Source/WebKit2:

* UIProcess/API/cpp/WKRetainPtr.h: Take out conditionals.

Source/WTF:

* wtf/RefPtr.h:
* wtf/RetainPtr.h:
* wtf/Vector.h:
* wtf/text/AtomicString.h:
* wtf/text/WTFString.h:
Take out conditionals.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove createOwned
https://bugs.webkit.org/show_bug.cgi?id=122388

Reviewed by Darin Adler.

Source/JavaScriptCore:

* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::save):

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::~Document):
(WebCore::Document::createRenderTree):
(WebCore::Document::destroyRenderTree):
* dom/Document.h:
* page/Frame.cpp:
(WebCore::Frame::Frame):
* page/Frame.h:
* page/animation/AnimationController.cpp:
(WebCore::AnimationController::AnimationController):
* page/animation/AnimationController.h:
* platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.h:
* platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm:
(WebCore::AudioTrackPrivateAVFObjC::AudioTrackPrivateAVFObjC):
(WebCore::AudioTrackPrivateAVFObjC::setPlayerItemTrack):
* platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp:
(WebCore::VideoTrackPrivateAVFObjC::VideoTrackPrivateAVFObjC):
(WebCore::VideoTrackPrivateAVFObjC::setPlayerItemTrack):
* platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.h:
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceClipper.h:
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
* rendering/svg/RenderSVGResourceFilter.h:
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
* rendering/svg/RenderSVGResourceMasker.h:

Source/WebKit2:

* UIProcess/API/mac/WKView.mm:
(-[WKView _setFindIndicator:fadeOut:animate:]):
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
(WKBundlePageOverlayCreate):

Source/WTF:

Since we're going with std::unique_ptr instead of OwnPtr, there's no need for makeOwned to exist.
Get rid of it and replace it with calls to std::make_unique.

* wtf/FilePrintStream.cpp:
(WTF::FilePrintStream::open):
* wtf/FilePrintStream.h:
* wtf/HashTable.h:
(WTF::::HashTable):
* wtf/ListHashSet.h:
(WTF::::ListHashSet):
* wtf/OwnPtr.h:
* wtf/Threading.cpp:
(WTF::compatEntryPoint):
(WTF::createThread):
* wtf/ThreadingPthreads.cpp:
(WTF::wtfThreadEntryPoint):
(WTF::createThreadInternal):
* wtf/unicode/Collator.h:
* wtf/unicode/CollatorDefault.cpp:
(WTF::Collator::userDefault):
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::userDefault):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to #define final to sealed when building with MSVC
https://bugs.webkit.org/show_bug.cgi?id=122386

Reviewed by Darin Adler.

* wtf/Compiler.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156969 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Undo texture unit code refactoring - it is ok to bind a texture to multiple locations
https://bugs.webkit.org/show_bug.cgi?id=122369
<rdar://problem/15158465>

Reviewed by Darin Adler.

The optimisation in r152351 (http://webkit.org/b/117868) incorrectly
assumes that a texture cannot be bound to more than one location.
That's true only within the same program object. It's legal to
address TEXTURE_BINDING_2D and TEXTURE_BINDING_CUBE_MAP with the
same texture in different programs.

See https://github.com/KhronosGroup/WebGL/pull/391 for more information.

This change reverts the optimisation, but also does some minor
cleanup (0 -> nullptr, class -> struct).

Covered by the following Khronos WebGL 1.0.1 tests, which
now pass:
- conformance/more/functions/texImage2DHTML.html
- conformance/more/functions/texSubImage2D.html
- conformance/more/functions/texSubImage2DHTML.html

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::~WebGLRenderingContext):
(WebCore::WebGLRenderingContext::reshape):
(WebCore::WebGLRenderingContext::bindTexture):
(WebCore::WebGLRenderingContext::deleteTexture):
(WebCore::WebGLRenderingContext::getParameter):
(WebCore::WebGLRenderingContext::handleNPOTTextures):
(WebCore::WebGLRenderingContext::validateTextureBinding):
(WebCore::WebGLRenderingContext::restoreCurrentTexture2D):
* html/canvas/WebGLRenderingContext.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebGL] program should not be able to link if a bad shader is attached
https://bugs.webkit.org/show_bug.cgi?id=94036

Reviewed by Darin Adler.

If you attempt to link a program when bad shaders are attached, the
link should fail. WebGL also requires that the previously linked
program should remain intact. We were doing the former, but not
the latter.

Fix this by not calling glLinkProgram if we know we have bad
shaders, and synthesize a bad link status instead.

Test: WebGL conformance test conformance/programs/program-test.html
(found in LayoutTests/webgl)

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::compileShader): Mark a shader as valid
if it compiled ok.
(WebCore::WebGLRenderingContext::linkProgram): Don't call into GraphicsContext3D::linkProgram
if we know that we don't have valid shaders.
* html/canvas/WebGLShader.cpp:
(WebCore::WebGLShader::WebGLShader): Initialize m_isValid.
* html/canvas/WebGLShader.h:
(WebCore::WebGLShader::isValid): New member variable getter and setter.
(WebCore::WebGLShader::setValid):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156971 268f45cc-cd09-0410-ab3c-d52691b4dbfc