* fast/css/computed-style-expected.txt: Updated now that we've eliminated the auto value.
* fast/css/computed-style-without-renderer-expected.txt: ditto.
-2007-08-14 Beth Dakin <bdakin@apple.com>
-
- Test for new support of empty style sheets.
-
- * fast/css/emptyStyleTag-expected.txt: Added.
- * fast/css/emptyStyleTag.html: Added.
-
2007-08-14 Justin Garcia <justin.garcia@apple.com>
Reviewed by Tim.
+++ /dev/null
-This tests that we support empty style sheets.
-Test succeeded!
+++ /dev/null
-<style></style>
-
-This tests that we support empty style sheets.
-
-<div id="result">Test failed.</div>
-
-<script>
-if (layoutTestController)
- layoutTestController.dumpAsText();
-
-if (document.styleSheets[0]) {
- var result = document.getElementById("result");
- result.innerHTML = "Test succeeded!";
-}
-</script>
-
* rendering/RenderFlexibleBox.cpp:(WebCore::RenderFlexibleBox::layoutVerticalBox): Use
max to make sure it never computes a minimum of less than one line.
-2007-08-14 Beth Dakin <bdakin@apple.com>
-
- Reviewed by Hyatt.
-
- 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:
-
2007-08-14 Brady Eidson <beidson@apple.com>
Reviewed by Darin, John, Maciej, Oliver, and Tim
}
// This method is called whenever a top-level stylesheet has finished loading.
-void Document::removePendingSheet()
+void Document::stylesheetLoaded()
{
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
ASSERT(m_pendingStylesheets > 0);
/**
* Updates the pending sheet count and then calls updateStyleSelector.
*/
- void removePendingSheet();
+ void stylesheetLoaded();
/**
* This method returns true if all top-level stylesheets have loaded (including
// until they know all of their nested <param>s. [Radar 3603191, 4040848].
// Also used for script elements and some SVG elements for similar purposes,
// but making parsing a special case in this respect should be avoided if possible.
- virtual void finishedParsing() { }
+ virtual void closeRenderer() { }
// Called by the frame right before dispatching an unloadEvent. [Radar 4532113]
// This is needed for HTMLInputElements to tell the frame that it is done editing
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
return true;
}
return false;
return m_sheet.get();
}
-void StyleElement::insertedIntoDocument(Document* document, Element* element)
+void StyleElement::insertedIntoDocument(Document* document)
{
- process(element);
+ if (m_sheet) {
+ if (static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading()
+ && (m_sheet->type().isEmpty() || m_sheet->type() == "text/css"))
+ document->addPendingSheet();
+ document->updateStyleSelector();
+ }
}
void StyleElement::removedFromDocument(Document* document)
{
- if (m_sheet)
+ if (m_sheet) {
+ if (static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading()
+ && (m_sheet->type().isEmpty() || m_sheet->type() == "text/css"))
+ document->stylesheetLoaded();
document->updateStyleSelector();
+ }
}
-void StyleElement::process(Element* e)
+void StyleElement::childrenChanged(Element* e)
{
- if (!e || !e->inDocument())
+ if (!e)
return;
-
String text = "";
for (Node* c = e->firstChild(); c; c = c->nextSibling())
{
Document* document = e->document();
if (m_sheet) {
- if (static_cast<CSSStyleSheet*>(m_sheet.get())->isLoading())
- document->removePendingSheet();
+ if (static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading())
+ document->stylesheetLoaded(); // Remove ourselves from the sheet list.
m_sheet = 0;
}
MediaQueryEvaluator screenEval("screen", true);
MediaQueryEvaluator printEval("print", true);
if (screenEval.eval(mediaList.get()) || printEval.eval(mediaList.get())) {
- document->addPendingSheet();
+ if (e->inDocument())
+ document->addPendingSheet();
setLoading(true);
m_sheet = new CSSStyleSheet(e, String(), document->inputEncoding());
m_sheet->parseString(text, !document->inCompatMode());
}
}
- if (m_sheet)
+ if (m_sheet && e->inDocument())
m_sheet->checkLoaded();
}
virtual const AtomicString& type() const = 0;
virtual const AtomicString& media() const = 0;
- void insertedIntoDocument(Document*, Element*);
+ void insertedIntoDocument(Document*);
void removedFromDocument(Document*);
- void process(Element*);
+ void childrenChanged(Element*);
void createSheet(Element* e, const String& text = String());
#include "FrameView.h"
#include "HTMLNames.h"
#include "HTMLScriptElement.h"
-#include "HTMLStyleElement.h"
#include "HTMLTableSectionElement.h"
#include "HTMLTokenizer.h"
#include "ProcessingInstruction.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
-#include "SVGStyleElement.h"
#ifndef USE_QXMLSTREAM
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
if (newElement->hasTagName(scriptTag))
static_cast<HTMLScriptElement*>(newElement.get())->setCreatedByParser(true);
- else if (newElement->hasTagName(HTMLNames::styleTag))
- static_cast<HTMLStyleElement*>(newElement.get())->setCreatedByParser(true);
-#if ENABLE(SVG)
- else if (newElement->hasTagName(SVGNames::scriptTag))
- static_cast<HTMLScriptElement*>(newElement.get())->setCreatedByParser(true);
- else if (newElement->hasTagName(SVGNames::styleTag))
- static_cast<SVGStyleElement*>(newElement.get())->setCreatedByParser(true);
-#endif
if (newElement->hasTagName(HTMLNames::scriptTag)
#if ENABLE(SVG)
Node* n = m_currentNode;
RefPtr<Node> parent = n->parentNode();
- n->finishedParsing();
+ n->closeRenderer();
// don't load external scripts for standalone documents (for now)
if (n->isElementNode() && m_view && (static_cast<Element*>(n)->hasTagName(scriptTag)
Node* n = m_currentNode;
RefPtr<Node> parent = n->parentNode();
- n->finishedParsing();
+ n->closeRenderer();
// don't load external scripts for standalone documents (for now)
if (n->isElementNode() && m_view && (static_cast<Element*>(n)->hasTagName(scriptTag)
}
#endif
-void HTMLAppletElement::finishedParsing()
+void HTMLAppletElement::closeRenderer()
{
// The parser just reached </applet>, so all the params are available now.
m_allParamsAvailable = true;
if (renderer())
renderer()->setNeedsLayout(true); // This will cause it to create its widget & the Java applet
- HTMLPlugInElement::finishedParsing();
+ HTMLPlugInElement::closeRenderer();
}
void HTMLAppletElement::detach()
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void finishedParsing();
+ virtual void closeRenderer();
virtual void detach();
#if USE(JAVASCRIPTCORE_BINDINGS)
HTMLGenericFormElement::didMoveToNewOwnerDocument();
}
-void HTMLFormControlElementWithState::finishedParsing()
+void HTMLFormControlElementWithState::closeRenderer()
{
Document* doc = document();
if (doc->hasStateForNewFormElements()) {
HTMLFormControlElementWithState(const QualifiedName& tagName, Document*, HTMLFormElement*);
virtual ~HTMLFormControlElementWithState();
- virtual void finishedParsing();
+ virtual void closeRenderer();
virtual bool saveState(String& value) const = 0;
if (m_cachedSheet) {
m_cachedSheet->deref(this);
if (m_loading && !isDisabled() && !isAlternate())
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
}
}
// a main sheet or a sheet that was previously enabled via script, then we need
// to remove it from the list of pending sheets.
if (m_disabledState == 2 && (!m_alternate || oldDisabledState == 1))
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
// Check #2: An alternate sheet becomes enabled while it is still loading.
if (m_alternate && m_disabledState == 1)
if (m_cachedSheet) {
if (m_loading)
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
m_cachedSheet->deref(this);
}
m_loading = true;
m_cachedSheet->ref(this);
else if (!isAlternate()) { // request may have been denied if stylesheet is local and document is remote.
m_loading = false;
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
}
}
} else if (m_sheet) {
bool HTMLLinkElement::sheetLoaded()
{
if (!isLoading() && !isDisabled() && !isAlternate()) {
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
return true;
}
return false;
}
}
-void HTMLObjectElement::finishedParsing()
+void HTMLObjectElement::closeRenderer()
{
// The parser just reached </object>.
setComplete(true);
- HTMLPlugInElement::finishedParsing();
+ HTMLPlugInElement::closeRenderer();
}
void HTMLObjectElement::setComplete(bool complete)
virtual void attach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void finishedParsing();
+ virtual void closeRenderer();
virtual void detach();
virtual void insertedIntoDocument();
virtual void removedFromDocument();
} else {
if (parentAttached && !n->attached() && !m_isParsingFragment)
n->attach();
- n->finishedParsing();
+ n->closeRenderer();
}
return true;
// Form elements restore their state during the parsing process.
// Also, a few elements (<applet>, <object>) need to know when all child elements (<param>s) are available.
if (current && elem->node != current)
- current->finishedParsing();
+ current->closeRenderer();
blockStack = elem->next;
current = elem->node;
HTMLElement::parseMappedAttribute(attr);
}
-void HTMLScriptElement::finishedParsing()
+void HTMLScriptElement::closeRenderer()
{
// The parser just reached </script>. If we have no src and no text,
// allow dynamic loading later.
if (getAttribute(srcAttr).isEmpty() && text().isEmpty())
setCreatedByParser(false);
- HTMLElement::finishedParsing();
+ HTMLElement::closeRenderer();
}
void HTMLScriptElement::insertedIntoDocument()
virtual bool isURLAttribute(Attribute *attr) const;
void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
- virtual void finishedParsing();
+ virtual void closeRenderer();
bool shouldExecuteAsJavaScript();
void evaluateScript(const String &URL, const String &script);
HTMLStyleElement::HTMLStyleElement(Document* doc)
: HTMLElement(styleTag, doc)
, m_loading(false)
- , m_createdByParser(false)
{
}
HTMLElement::parseMappedAttribute(attr);
}
-void HTMLStyleElement::finishedParsing()
-{
- StyleElement::process(this);
- HTMLElement::finishedParsing();
-}
-
void HTMLStyleElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
-
- if (!m_createdByParser)
- StyleElement::insertedIntoDocument(document(), this);
+ StyleElement::insertedIntoDocument(document());
}
void HTMLStyleElement::removedFromDocument()
void HTMLStyleElement::childrenChanged()
{
- StyleElement::process(this);
+ StyleElement::childrenChanged(this);
}
StyleSheet* HTMLStyleElement::sheet()
bool HTMLStyleElement::sheetLoaded()
{
if (!isLoading()) {
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
return true;
}
return false;
virtual void removedFromDocument();
virtual void childrenChanged();
- void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
- virtual void finishedParsing();
-
virtual bool isLoading() const;
virtual bool sheetLoaded();
protected:
String m_media;
bool m_loading;
- bool m_createdByParser;
};
} //namespace
return result;
}
-void SVGAnimationElement::finishedParsing()
+void SVGAnimationElement::closeRenderer()
{
ownerSVGElement()->timeScheduler()->addTimer(this, lround(getStartTime()));
- SVGElement::finishedParsing();
+ SVGElement::closeRenderer();
}
String SVGAnimationElement::targetAttributeAnimatedValue() const
virtual void parseMappedAttribute(MappedAttribute* attr);
- virtual void finishedParsing();
+ virtual void closeRenderer();
virtual bool updateAnimationBaseValueFromElement();
bool updateAnimatedValueForElapsedSeconds(double elapsedSeconds);
}
}
-void SVGElement::finishedParsing()
+void SVGElement::closeRenderer()
{
- // finishedParsing() is called when the close tag is reached for an element (e.g. </svg>)
+ // closeRenderer() is called when the close tag is reached for an element (e.g. </svg>)
// we send SVGLoad events here if we can, otherwise they'll be sent when any required loads finish
sendSVGLoadEventIfPossible();
}
// For SVGTests
virtual bool isValid() const { return true; }
- virtual void finishedParsing();
+ virtual void closeRenderer();
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
virtual bool childShouldCreateRenderer(Node*) const;
SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* doc)
: SVGElement(tagName, doc)
- , m_createdByParser(false)
{
}
SVGElement::parseMappedAttribute(attr);
}
-void SVGStyleElement::finishedParsing()
-{
- StyleElement::process(this);
- SVGElement::finishedParsing();
-}
-
void SVGStyleElement::insertedIntoDocument()
{
SVGElement::insertedIntoDocument();
-
- if (!m_createdByParser)
- StyleElement::insertedIntoDocument(document(), this);
+ StyleElement::insertedIntoDocument(document());
}
void SVGStyleElement::removedFromDocument()
void SVGStyleElement::childrenChanged()
{
- StyleElement::process(this);
+ StyleElement::childrenChanged(this);
}
StyleSheet* SVGStyleElement::sheet()
bool SVGStyleElement::sheetLoaded()
{
- document()->removePendingSheet();
+ document()->stylesheetLoaded();
return true;
}
virtual void removedFromDocument();
virtual void childrenChanged();
- void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
- virtual void finishedParsing();
-
// 'SVGStyleElement' functions
const AtomicString& xmlspace() const;
void setXmlspace(const AtomicString&, ExceptionCode&);
void setTitle(const AtomicString&, ExceptionCode&);
StyleSheet* sheet();
-
- protected:
- bool m_createdByParser;
};
} // namespace WebCore
~UserStyleSheetLoader()
{
if (!m_cachedSheet->isLoaded())
- m_document->removePendingSheet();
+ m_document->stylesheetLoaded();
m_cachedSheet->deref(this);
}
private:
virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const String& sheet)
{
- m_document->removePendingSheet();
+ m_document->stylesheetLoaded();
if (Frame* frame = m_document->frame())
frame->setUserStyleSheet(sheet);
}