[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