Reviewed by Hyatt.

        Rolling back in. I made a silly mistake in XMLTokenizer that caused 
        this patch to crash SVG tests. It's fixed now!

        Refactor of change for <rdar://problem/5404899> REGRESSION: Mail 
        crash in WebCore::FontFallbackList::fontDataAt() after dragging 
        image into text multiple times

        The original fix that I made last night prevents the pending style 
        sheet count from being incremented until the element is in the 
        document. This fix prevents the style sheet from loading at all 
        until it is in the document.

        Here is the fix.
        * dom/StyleElement.cpp:
        (WebCore::StyleElement::insertedIntoDocument): Call process.
        (WebCore::StyleElement::removedFromDocument): This can be reverted 
        to its original state before my patch last night.
        (WebCore::StyleElement::process): childrenChanged is now called 
        process. Return early if your not in the document.
        (WebCore::StyleElement::createSheet): Revert change from last 
        night. The inDocument check is now in caller childrenChanged.
        * dom/StyleElement.h: insertedIntoDocument() must now accept an 
        element in addition to a document.

        This is an optimization to prevent calling updateStyleSelector() 
        too frequently.
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::startElementNs):
        * html/HTMLStyleElement.cpp:
        (WebCore::HTMLStyleElement::HTMLStyleElement):
        (WebCore::HTMLStyleElement::finishedParsing):
        (WebCore::HTMLStyleElement::insertedIntoDocument):
        (WebCore::HTMLStyleElement::childrenChanged):
        (WebCore::HTMLStyleElement::sheetLoaded):
        * html/HTMLStyleElement.h:
        * ksvg2/svg/SVGStyleElement.cpp:
        (WebCore::SVGStyleElement::SVGStyleElement):
        (WebCore::SVGStyleElement::finishedParsing):
        (WebCore::SVGStyleElement::insertedIntoDocument):
        (WebCore::SVGStyleElement::childrenChanged):
        (WebCore::SVGStyleElement::sheetLoaded):
        * ksvg2/svg/SVGStyleElement.h:
        (WebCore::SVGStyleElement::setCreatedByParser):

        This is a name change. Document::stylesheetLoaded() 
        is now Document::removePendingSheet()
        * dom/Document.cpp:
        (WebCore::Document::removePendingSheet):
        * dom/Document.h:
        * dom/ProcessingInstruction.cpp:
        (WebCore::ProcessingInstruction::sheetLoaded):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::~HTMLLinkElement):
        (WebCore::HTMLLinkElement::setDisabledState):
        (WebCore::HTMLLinkElement::process):
        (WebCore::HTMLLinkElement::sheetLoaded):
        * page/Frame.cpp:
        (WebCore::UserStyleSheetLoader::~UserStyleSheetLoader):
        (WebCore::UserStyleSheetLoader::setCSSStyleSheet):

        This is another name change. closeRenderer() is now 
        finishedParsing()
        * dom/Node.h:
        (WebCore::Node::finishedParsing):
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::endElementNs):
        (WebCore::):
        * html/HTMLAppletElement.cpp:
        (WebCore::HTMLAppletElement::finishedParsing):
        * html/HTMLAppletElement.h:
        * html/HTMLGenericFormElement.cpp:
        (WebCore::HTMLFormControlElementWithState::finishedParsing):
        * html/HTMLGenericFormElement.h:
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::finishedParsing):
        * html/HTMLObjectElement.h:
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::insertNode):
        (WebCore::HTMLParser::popOneBlockCommon):
        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::finishedParsing):
        * html/HTMLScriptElement.h:
        (WebCore::HTMLStyleElement::setCreatedByParser):
        * ksvg2/svg/SVGAnimationElement.cpp:
        (WebCore::SVGAnimationElement::finishedParsing):
        * ksvg2/svg/SVGAnimationElement.h:
        * ksvg2/svg/SVGElement.cpp:
        (WebCore::SVGElement::finishedParsing):
        * ksvg2/svg/SVGElement.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@25098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed