[WK1] NPStream::headers not initialized
https://bugs.webkit.org/show_bug.cgi?id=119574

Reviewed by Alexey Proskuryakov.

Initialize the header field. According to user feedback that should solve some
cases of random crashes when loading plugins on Mac and Windows.

* plugins/PluginStream.cpp:
(WebCore::PluginStream::PluginStream):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Inserting multiple rules into an empty style sheet should avoid style recalc if possible.
<http://webkit.org/b/119568>

Reviewed by Antti Koivisto.

As a follow-up to <http://webkit.org/b/119475>, where I added a hack for inserting
a single rule into an empty style sheet, this broadens the optimization to support
any number of rules.

This optimizes the scenario where a style sheet is added to the DOM and then populated
rule-by-rule via CSSOM insertRule()/addRule() calls. Previously we'd do a full style
recalc for this case, but now we'll treat it the same as a full sheet added at once.

* css/CSSStyleSheet.h:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::willMutateRules):

    Made willMutateRules() return whether the style sheet contents were cloned by the
    copy-on-write mechanism.

* dom/Document.h:
(WebCore::CSSStyleSheet::didMutateRules):
(WebCore::CSSStyleSheet::insertRule):

    Replaced the InsertionIntoEmptySheet mutation type by a general RuleInsertion.
    The mutation callback checks if we're inserting into a rule that's not (yet) part
    of the document's active sheet set. In that case, we defer doing the style sheet
    until all the insertions are done (or something forces us to style+layout.)

    Note that this optimization only happens if the style sheet had a single client.
    Shared style sheets that just got cloned before mutation may have pointers into
    them from the Document's StyleResolver, so we're forced to do an immediate sheet
    update in that case.

(WebCore::CSSStyleSheet::RuleMutationScope::RuleMutationScope):
(WebCore::CSSStyleSheet::RuleMutationScope::~RuleMutationScope):

    Moved these out-of-line.

(WebCore::CSSStyleSheet::didMutateRuleFromCSSStyleDeclaration):
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::StyleRuleCSSStyleDeclaration::didMutate):

    Made a separate mutation callback for CSSStyleDeclaration since its needs are
    so simple compared to the mutation callback from CSSStyleSheet. Seems better
    than adding yet another mode to the enum.

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::recalcStyle):
(WebCore::Document::styleResolverChanged):
(WebCore::Document::optimizedStyleSheetUpdateTimerFired):
(WebCore::Document::scheduleOptimizedStyleSheetUpdate):

    Added mechanism to defer doing a RecalcStyleIfNeeded.

(WebCore::Document::updateStyleIfNeeded):

    Synchronize the optimized style sheet update if there's one scheduled.
    This ensures that stuff like layout-dependent property access won't operate
    on stale style.

* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::pendingUpdateType):
(WebCore::DocumentStyleSheetCollection::setPendingUpdateType):
(WebCore::DocumentStyleSheetCollection::flushPendingUpdates):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):

    Have DSSC track the kind of style sheet update it needs to do (instead of just
    a boolean "needs update.") This is used by Document::recalcStyle() to make sure
    the right kind of update happens if there's one scheduled.

(WebCore::DocumentStyleSheetCollection::activeStyleSheetsContains):

    Added helper to check if a CSSStyleSheet is part of the active set.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        WTR::pathSuitableForTestResult should behave the same as _drt_descriptionSuitableForTestResult so we can unskip tests.
        https://bugs.webkit.org/show_bug.cgi?id=116125

        Reviewed by Tim Horton. Tweaked and re-landed by Alexey Proskuryakov.

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::pathSuitableForTestResult):
        Changed string operations to match _drt_descriptionSuitableForTestResult.
        (WTR::dumpRequestDescriptionSuitableForTestResult):
        (WTR::dumpResponseDescriptionSuitableForTestResult):
        (WTR::InjectedBundlePage::willPerformClientRedirectForFrame):
        (WTR::InjectedBundlePage::didInitiateLoadForResource):
        (WTR::InjectedBundlePage::willSendRequestForFrame):
        (WTR::InjectedBundlePage::didReceiveResponseForResource):
        Pass the main frame's URL to pathSuitableForTestResult.
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
        Added WKBundlePageRef to willPerformClientRedirectForFrame.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r147019): Page has extra space
https://bugs.webkit.org/show_bug.cgi?id=119424

Reviewed by David Hyatt.

Clear the overflow rect before recomputing it in table sections.

No new tests: the reduction uses jquery and I was unable to simulate the reduction without it.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
(WebCore::RenderTableSection::computeOverflowFromCells):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
svg/custom/use-href-update-crash.svg failing on certain platforms
https://bugs.webkit.org/show_bug.cgi?id=104054

Reviewed by Darin Adler.

Fix mistake in use-href-update-crash.svg which caused the gc() not found problem. Update the test expectations
that had this marked as failure, it passes after the test fix.

* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* svg/custom/use-href-update-crash.svg:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fullscreen/exit-full-screen-iframe.html is failing
https://bugs.webkit.org/show_bug.cgi?id=90708

Unreviewed gardening.

* platform/mac/TestExpectations: Unskip passing test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash in WTF::RefPtr<WebCore::SpaceSplitStringData>::operator UnspecifiedBoolType
https://bugs.webkit.org/show_bug.cgi?id=118839

Reviewed by Darin Adler.

Source/WebCore:

Take into account that elementData() can be null in classAttributeChanged.

Test: svg/animations/classAttributeSettingCrash.html

* dom/Element.cpp:
(WebCore::Element::classAttributeChanged):

LayoutTests:

Add testcase that showed up to cause a crash by the fuzzer.

* svg/animations/classAttributeSettingCrash-expected.txt: Added.
* svg/animations/classAttributeSettingCrash.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r130839): fast/canvas/webgl/arraybuffer-transfer-of-control.html is failing
https://bugs.webkit.org/show_bug.cgi?id=99096

Unreviewed gardening.

* platform/mac/TestExpectations: Unskip passing test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fast/events/scroll-div-with-prevent-default-in-subframe.html is failing
https://bugs.webkit.org/show_bug.cgi?id=82747

Unreviewed gardening.

* platform/mac/TestExpectations: Unskip passing test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EME] Implement MediaKeys.isTypeSupported()
https://bugs.webkit.org/show_bug.cgi?id=119586

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/encrypted-media/encrypted-media-is-type-supported.html

The EME spec has removed the extra keySystem parameter from
HTMLMediaElement.canPlayType() in favor of a new isTypeSupported()
method on MediaKeys.

To implement this method, the CDMFactory needs to know whether the
registered CDM supports the specified mime type.  CDMs must register
this new factory method, which requires changes to CDMPrivateAVFoundation
and MockCDM.

Add the new MediaKeys.isTypeSupported() method:
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::isTypeSupported):
* Modules/encryptedmedia/MediaKeys.h:
* Modules/encryptedmedia/MediaKeys.idl:

Add the new factory CDMSupportsKeySystemAndMimeType method:
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDMFactory::CDMFactory): Now takes a third parameter.
(WebCore::installedCDMFactories): When adding the AVFoundation CDM, pass its new method.
(WebCore::CDM::registerCDMFactory): Now takes a third parameter.
(WebCore::CDM::keySystemSupportsMimeType): Added.
* Modules/encryptedmedia/CDM.h:
* WebCore.exp.in:

Register this new method with the factory for all concrete CDMs:
* Modules/encryptedmedia/CDMPrivateAVFoundation.h:
* Modules/encryptedmedia/CDMPrivateAVFoundation.mm:
(WebCore::CDMPrivateAVFoundation::supportsKeySystem):
(WebCore::CDMPrivateAVFoundation::supportsKeySystemAndMimeType):
* testing/Internals.cpp:
(WebCore::Internals::initializeMockCDM):
* testing/MockCDM.cpp:
(WebCore::MockCDM::supportsKeySystem):
(WebCore::MockCDM::supportsKeySystemAndMimeType):
* testing/MockCDM.h:

LayoutTests:

* media/encrypted-media/encrypted-media-is-type-supported-expected.txt: Added.
* media/encrypted-media/encrypted-media-is-type-supported.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        WKBundleFrameCopyProvisionalURL crashes when there is no provisional loader
        https://bugs.webkit.org/show_bug.cgi?id=119587

        Reviewed by Darin Adler.

        * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::provisionalURL): Added a null
        check, like we already have in WebFrame::url().



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unprefix use of transitions in Web Inspector code
https://bugs.webkit.org/show_bug.cgi?id=119588

Reviewed by Tim Hatcher.

Replace "-webkit-transition" with "transition".

* UserInterface/CSSCompletions.js:
(WebInspector.CSSCompletions.requestCSSNameCompletions.collectPropertyNameForCodeMirror):
* UserInterface/FindBanner.css:
(.find-banner):
(.find-banner.showing):
(.supports-find-banner.no-find-banner-transition):
(.supports-find-banner):
(.supports-find-banner.showing-find-banner):
* UserInterface/NetworkTimeline.css:
(.network-graph-side:hover .network-graph-label):
* UserInterface/Popover.css:
(.popover.fade-out):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Layout Test fast/overflow/scrollbar-click-retains-focus.html is failing on Apple Mac WK1 and GTK.
https://bugs.webkit.org/show_bug.cgi?id=104104

Unreviewed gardening.

* platform/mac/TestExpectations: Unskip passing test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
http/tests/navigation/back-twice-without-commit.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=82980

Unreviewed gardening.

* platform/mac/TestExpectations: Unskip passing test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Work towards WebGL on AppleWin port.
https://bugs.webkit.org/show_bug.cgi?id=119562

Reviewed by Brent Fulgham.

* WebCore.vcxproj/WebCore.vcxproj:
Build GLContext.cpp and GraphicsContext3DPrivate.cpp on AppleWin port.
* WebCore.vcxproj/WebCore.vcxproj.filters:
Moved GLContext and GraphicsContext3DPrivate from Cairo filter to graphics.
* platform/graphics/GraphicsContext3D.h:
Added m_webGLLayer for AppleWin port.
* platform/graphics/GraphicsContext3DPrivate.cpp:
Protected inclusion of PlatformContextCairo.h in USE(CAIRO) macro for non-cairo ports.
* platform/graphics/win/GraphicsContext3DWin.cpp:
Removed stub GraphicsContext3DPrivate implementation in favor of GraphicsContext3DPrivate.cpp.
(WebCore::GraphicsContext3D::GraphicsContext3D):
Added GraphicsContext3DPrivate and PlatformCALayer initialization.
(WebCore::GraphicsContext3D::makeContextCurrent):
(WebCore::GraphicsContext3D::platformGraphicsContext3D):
Added implementation based on Cairo ports' to be refactored soon.
(WebCore::GraphicsContext3D::platformLayer):
Return PlatformCALayer's PlatformLayer instead of 0.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fast/events/scroll-div-with-prevent-default-in-subframe.html is failing
https://bugs.webkit.org/show_bug.cgi?id=82747

Unreviewed gardening.

* platform/mac/TestExpectations: Mark test as flakey, it doesn't always pass.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Improper Caption Button Displayed to Users
https://bugs.webkit.org/show_bug.cgi?id=119593 

Reviewed by Eric Carlson.

Remove the custom drawing code for the Windows port, and
have it render using the CSS/SVG markup like we do on OS X.

* rendering/RenderThemeWin.cpp: Remove drawing code.
* rendering/RenderThemeWin.h: Remove declaration.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fullscreen/exit-full-screen-iframe.html is failing
https://bugs.webkit.org/show_bug.cgi?id=90708

Unreviewed gardening.

* platform/mac/TestExpectations: Mark test as flakey, it doesn't always pass.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ASSERT_NOT_REACHED() touched in WebCore::SVGAnimatedStringAnimator::addAnimatedTypes
https://bugs.webkit.org/show_bug.cgi?id=113224

Reviewed by Dirk Schulze.

Source/WebCore:

Do not perform from-by animations for non-additive attributes.

Test: svg/animations/non-additive-type-from-by-animation.html

* svg/SVGAnimateElement.cpp:
(WebCore::SVGAnimateElement::calculateFromAndByValues):

LayoutTests:

Add a test for animating non-additive attributes in from-by animations

* svg/animations/non-additive-type-from-by-animation-expected.txt: Added.
* svg/animations/non-additive-type-from-by-animation.html: Added.
* svg/animations/resources/non-additive-type-from-by-animation.svg: Added.
* svg/animations/script-tests/non-additive-type-from-by-animation.js: Added.
(sample):
(executeTest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add logging to the primary plugin detection
https://bugs.webkit.org/show_bug.cgi?id=119594

Reviewed by Tim Horton.

Add some simple logging to our primary plug-in detection.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):

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