Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1287)

Unified Diff: third_party/WebKit/WebCore/html/HTMLParser.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/WebCore/html/HTMLParser.h ('k') | third_party/WebKit/WebCore/html/HTMLSelectElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/html/HTMLParser.cpp
===================================================================
--- third_party/WebKit/WebCore/html/HTMLParser.cpp (revision 9391)
+++ third_party/WebKit/WebCore/html/HTMLParser.cpp (working copy)
@@ -113,36 +113,36 @@
*/
HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors)
- : document(doc)
- , current(doc)
- , didRefCurrent(false)
- , blockStack(0)
+ : m_document(doc)
+ , m_current(doc)
+ , m_didRefCurrent(false)
+ , m_blockStack(0)
, m_hasPElementInScope(NotInScope)
- , head(0)
- , inBody(false)
- , haveContent(false)
- , haveFrameSet(false)
+ , m_head(0)
+ , m_inBody(false)
+ , m_haveContent(false)
+ , m_haveFrameSet(false)
, m_isParsingFragment(false)
, m_reportErrors(reportErrors)
, m_handlingResidualStyleAcrossBlocks(false)
- , inStrayTableContent(0)
+ , m_inStrayTableContent(0)
{
}
HTMLParser::HTMLParser(DocumentFragment* frag)
- : document(frag->document())
- , current(frag)
- , didRefCurrent(true)
- , blockStack(0)
+ : m_document(frag->document())
+ , m_current(frag)
+ , m_didRefCurrent(true)
+ , m_blockStack(0)
, m_hasPElementInScope(NotInScope)
- , head(0)
- , inBody(true)
- , haveContent(false)
- , haveFrameSet(false)
+ , m_head(0)
+ , m_inBody(true)
+ , m_haveContent(false)
+ , m_haveFrameSet(false)
, m_isParsingFragment(true)
, m_reportErrors(false)
, m_handlingResidualStyleAcrossBlocks(false)
- , inStrayTableContent(0)
+ , m_inStrayTableContent(0)
{
if (frag)
frag->ref();
@@ -151,26 +151,26 @@
HTMLParser::~HTMLParser()
{
freeBlock();
- if (didRefCurrent)
- current->deref();
+ if (m_didRefCurrent)
+ m_current->deref();
}
void HTMLParser::reset()
{
ASSERT(!m_isParsingFragment);
- setCurrent(document);
+ setCurrent(m_document);
freeBlock();
- inBody = false;
- haveFrameSet = false;
- haveContent = false;
- inStrayTableContent = 0;
+ m_inBody = false;
+ m_haveFrameSet = false;
+ m_haveContent = false;
+ m_inStrayTableContent = 0;
m_currentFormElement = 0;
m_currentMapElement = 0;
- head = 0;
+ m_head = 0;
m_isindexElement = 0;
m_skipModeTag = nullAtom;
@@ -178,13 +178,13 @@
void HTMLParser::setCurrent(Node* newCurrent)
{
- bool didRefNewCurrent = newCurrent && newCurrent != document;
+ bool didRefNewCurrent = newCurrent && newCurrent != m_document;
if (didRefNewCurrent)
newCurrent->ref();
- if (didRefCurrent)
- current->deref();
- current = newCurrent;
- didRefCurrent = didRefNewCurrent;
+ if (m_didRefCurrent)
+ m_current->deref();
+ m_current = newCurrent;
+ m_didRefCurrent = didRefNewCurrent;
}
PassRefPtr<Node> HTMLParser::parseToken(Token* t)
@@ -193,7 +193,7 @@
if (!t->beginTag && t->tagName == m_skipModeTag)
// Found the end tag for the current skip mode, so we're done skipping.
m_skipModeTag = nullAtom;
- else if (current->localName() == t->tagName)
+ else if (m_current->localName() == t->tagName)
// Do not skip </iframe>.
// FIXME: What does that comment mean? How can it be right to parse a token without clearing m_skipModeTag?
;
@@ -202,7 +202,7 @@
}
// Apparently some sites use </br> instead of <br>. Be compatible with IE and Firefox and treat this like <br>.
- if (t->isCloseTag(brTag) && document->inCompatMode()) {
+ if (t->isCloseTag(brTag) && m_document->inCompatMode()) {
reportError(MalformedBRError);
t->beginTag = true;
}
@@ -214,17 +214,17 @@
// Ignore spaces, if we're not inside a paragraph or other inline code.
// Do not alter the text if it is part of a scriptTag.
- if (t->tagName == textAtom && t->text && current->localName() != scriptTag) {
- if (inBody && !skipMode() && current->localName() != styleTag &&
- current->localName() != titleTag && !t->text->containsOnlyWhitespace())
- haveContent = true;
+ if (t->tagName == textAtom && t->text && m_current->localName() != scriptTag) {
+ if (m_inBody && !skipMode() && m_current->localName() != styleTag &&
+ m_current->localName() != titleTag && !t->text->containsOnlyWhitespace())
+ m_haveContent = true;
RefPtr<Node> n;
String text = t->text.get();
unsigned charsLeft = text.length();
while (charsLeft) {
// split large blocks of text to nodes of manageable size
- n = Text::createWithLengthLimit(document, text, charsLeft);
+ n = Text::createWithLengthLimit(m_document, text, charsLeft);
if (!insertNode(n.get(), t->selfClosingTag))
return 0;
}
@@ -269,8 +269,8 @@
if (m_currentFormElement == n)
m_currentFormElement = 0;
- if (head == n)
- head = 0;
+ if (m_head == n)
+ m_head = 0;
return 0;
}
@@ -280,25 +280,25 @@
void HTMLParser::parseDoctypeToken(DoctypeToken* t)
{
// Ignore any doctype after the first. Ignore doctypes in fragments.
- if (document->doctype() || m_isParsingFragment || current != document)
+ if (m_document->doctype() || m_isParsingFragment || m_current != m_document)
return;
// Make a new doctype node and set it as our doctype.
- document->addChild(DocumentType::create(document, String::adopt(t->m_name), String::adopt(t->m_publicID), String::adopt(t->m_systemID)));
+ m_document->addChild(DocumentType::create(m_document, String::adopt(t->m_name), String::adopt(t->m_publicID), String::adopt(t->m_systemID)));
}
-static bool isTableSection(Node* n)
+static bool isTableSection(const Node* n)
{
return n->hasTagName(tbodyTag) || n->hasTagName(tfootTag) || n->hasTagName(theadTag);
}
-static bool isTablePart(Node* n)
+static bool isTablePart(const Node* n)
{
return n->hasTagName(trTag) || n->hasTagName(tdTag) || n->hasTagName(thTag) ||
isTableSection(n);
}
-static bool isTableRelated(Node* n)
+static bool isTableRelated(const Node* n)
{
return n->hasTagName(tableTag) || isTablePart(n);
}
@@ -317,33 +317,33 @@
// <table> is never allowed inside stray table content. Always pop out of the stray table content
// and close up the first table, and then start the second table as a sibling.
- if (inStrayTableContent && localName == tableTag)
+ if (m_inStrayTableContent && localName == tableTag)
popBlock(tableTag);
// let's be stupid and just try to insert it.
// this should work if the document is well-formed
- Node* newNode = current->addChild(n);
+ Node* newNode = m_current->addChild(n);
if (!newNode)
return handleError(n, flat, localName, tagPriority); // Try to handle the error.
// don't push elements without end tags (e.g., <img>) on the stack
- bool parentAttached = current->attached();
+ bool parentAttached = m_current->attached();
if (tagPriority > 0 && !flat) {
- if (newNode == current) {
+ if (newNode == m_current) {
// This case should only be hit when a demoted <form> is placed inside a table.
ASSERT(localName == formTag);
- reportError(FormInsideTablePartError, &current->localName());
+ reportError(FormInsideTablePartError, &m_current->localName());
} else {
// The pushBlock function transfers ownership of current to the block stack
- // so we're guaranteed that didRefCurrent is false. The code below is an
+ // so we're guaranteed that m_didRefCurrent is false. The code below is an
// optimized version of setCurrent that takes advantage of that fact and also
// assumes that newNode is neither 0 nor a pointer to the document.
pushBlock(localName, tagPriority);
newNode->beginParsingChildren();
- ASSERT(!didRefCurrent);
+ ASSERT(!m_didRefCurrent);
newNode->ref();
- current = newNode;
- didRefCurrent = true;
+ m_current = newNode;
+ m_didRefCurrent = true;
}
if (parentAttached && !n->attached() && !m_isParsingFragment)
n->attach();
@@ -353,8 +353,8 @@
n->finishParsingChildren();
}
- if (localName == htmlTag && document->frame())
- document->frame()->loader()->dispatchDocumentElementAvailable();
+ if (localName == htmlTag && m_document->frame())
+ m_document->frame()->loader()->dispatchDocumentElementAvailable();
return true;
}
@@ -369,28 +369,28 @@
if (n->isHTMLElement()) {
HTMLElement* h = static_cast<HTMLElement*>(n);
if (h->hasLocalName(trTag) || h->hasLocalName(thTag) || h->hasLocalName(tdTag)) {
- if (inStrayTableContent && !isTableRelated(current)) {
- reportError(MisplacedTablePartError, &localName, &current->localName());
+ if (m_inStrayTableContent && !isTableRelated(m_current)) {
+ reportError(MisplacedTablePartError, &localName, &m_current->localName());
// pop out to the nearest enclosing table-related tag.
- while (blockStack && !isTableRelated(current))
+ while (m_blockStack && !isTableRelated(m_current))
popOneBlock();
return insertNode(n);
}
} else if (h->hasLocalName(headTag)) {
- if (!current->isDocumentNode() && !current->hasTagName(htmlTag)) {
+ if (!m_current->isDocumentNode() && !m_current->hasTagName(htmlTag)) {
reportError(MisplacedHeadError);
return false;
}
} else if (h->hasLocalName(metaTag) || h->hasLocalName(linkTag) || h->hasLocalName(baseTag)) {
bool createdHead = false;
- if (!head) {
+ if (!m_head) {
createHead();
createdHead = true;
}
- if (head) {
+ if (m_head) {
if (!createdHead)
- reportError(MisplacedHeadContentError, &localName, &current->localName());
- if (head->addChild(n)) {
+ reportError(MisplacedHeadContentError, &localName, &m_current->localName());
+ if (m_head->addChild(n)) {
if (!n->attached() && !m_isParsingFragment)
n->attach();
return true;
@@ -398,13 +398,13 @@
return false;
}
} else if (h->hasLocalName(htmlTag)) {
- if (!current->isDocumentNode() ) {
- if (document->documentElement() && document->documentElement()->hasTagName(htmlTag)) {
+ if (!m_current->isDocumentNode() ) {
+ if (m_document->documentElement() && m_document->documentElement()->hasTagName(htmlTag)) {
reportError(RedundantHTMLBodyError, &localName);
// we have another <HTML> element.... apply attributes to existing one
// make sure we don't overwrite already existing attributes
NamedAttrMap* map = static_cast<Element*>(n)->attributes(true);
- Element* existingHTML = static_cast<Element*>(document->documentElement());
+ Element* existingHTML = static_cast<Element*>(m_document->documentElement());
NamedAttrMap* bmap = existingHTML->attributes(false);
for (unsigned l = 0; map && l < map->length(); ++l) {
Attribute* it = map->attributeItem(l);
@@ -416,19 +416,19 @@
}
} else if (h->hasLocalName(titleTag) || h->hasLocalName(styleTag)) {
bool createdHead = false;
- if (!head) {
+ if (!m_head) {
createHead();
createdHead = true;
}
- if (head) {
- Node* newNode = head->addChild(n);
+ if (m_head) {
+ Node* newNode = m_head->addChild(n);
if (!newNode) {
setSkipMode(h->tagQName());
return false;
}
if (!createdHead)
- reportError(MisplacedHeadContentError, &localName, &current->localName());
+ reportError(MisplacedHeadContentError, &localName, &m_current->localName());
pushBlock(localName, tagPriority);
newNode->beginParsingChildren();
@@ -437,18 +437,18 @@
n->attach();
return true;
}
- if (inBody) {
+ if (m_inBody) {
setSkipMode(h->tagQName());
return false;
}
} else if (h->hasLocalName(bodyTag)) {
- if (inBody && document->body()) {
+ if (m_inBody && m_document->body()) {
// we have another <BODY> element.... apply attributes to existing one
// make sure we don't overwrite already existing attributes
// some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor>
reportError(RedundantHTMLBodyError, &localName);
NamedAttrMap* map = static_cast<Element*>(n)->attributes(true);
- Element* existingBody = document->body();
+ Element* existingBody = m_document->body();
NamedAttrMap* bmap = existingBody->attributes(false);
for (unsigned l = 0; map && l < map->length(); ++l) {
Attribute* it = map->attributeItem(l);
@@ -457,11 +457,11 @@
}
return false;
}
- else if (!current->isDocumentNode())
+ else if (!m_current->isDocumentNode())
return false;
} else if (h->hasLocalName(areaTag)) {
if (m_currentMapElement) {
- reportError(MisplacedAreaError, &current->localName());
+ reportError(MisplacedAreaError, &m_current->localName());
m_currentMapElement->addChild(n);
if (!n->attached() && !m_isParsingFragment)
n->attach();
@@ -470,18 +470,18 @@
}
return false;
} else if (h->hasLocalName(colgroupTag) || h->hasLocalName(captionTag)) {
- if (isTableRelated(current)) {
- while (blockStack && isTablePart(current))
+ if (isTableRelated(m_current)) {
+ while (m_blockStack && isTablePart(m_current))
popOneBlock();
return insertNode(n);
}
}
- } else if (n->isCommentNode() && !head)
+ } else if (n->isCommentNode() && !m_head)
return false;
// 2. Next we examine our currently active element to do some further error handling.
- if (current->isHTMLElement()) {
- HTMLElement* h = static_cast<HTMLElement*>(current);
+ if (m_current->isHTMLElement()) {
+ HTMLElement* h = static_cast<HTMLElement*>(m_current);
const AtomicString& currentTagName = h->localName();
if (h->hasLocalName(htmlTag)) {
HTMLElement* elt = n->isHTMLElement() ? static_cast<HTMLElement*>(n) : 0;
@@ -490,9 +490,9 @@
elt->hasLocalName(objectTag) || elt->hasLocalName(embedTag) ||
elt->hasLocalName(titleTag) || elt->hasLocalName(isindexTag) ||
elt->hasLocalName(baseTag))) {
- if (!head) {
- head = new HTMLHeadElement(headTag, document);
- e = head;
+ if (!m_head) {
+ m_head = new HTMLHeadElement(headTag, m_document);
+ e = m_head;
insertNode(e);
handled = true;
}
@@ -502,8 +502,8 @@
if (t->containsOnlyWhitespace())
return false;
}
- if (!haveFrameSet) {
- e = new HTMLBodyElement(bodyTag, document);
+ if (!m_haveFrameSet) {
+ e = new HTMLBodyElement(bodyTag, m_document);
startBody();
insertNode(e);
handled = true;
@@ -515,9 +515,9 @@
return false;
else {
// This means the body starts here...
- if (!haveFrameSet) {
+ if (!m_haveFrameSet) {
popBlock(currentTagName);
- e = new HTMLBodyElement(bodyTag, document);
+ e = new HTMLBodyElement(bodyTag, m_document);
startBody();
insertNode(e);
handled = true;
@@ -545,7 +545,7 @@
handled = true; // ...and start a new one
} else {
ExceptionCode ec = 0;
- Node* node = current;
+ Node* node = m_current;
Node* parent = node->parentNode();
// A script may have removed the current node's parent from the DOM
// http://bugs.webkit.org/show_bug.cgi?id=7137
@@ -577,24 +577,24 @@
pushBlock(localName, tagPriority);
n->beginParsingChildren();
setCurrent(n);
- inStrayTableContent++;
- blockStack->strayTableContent = true;
+ m_inStrayTableContent++;
+ m_blockStack->strayTableContent = true;
}
return true;
}
}
if (!ec) {
- if (current->hasTagName(trTag)) {
+ if (m_current->hasTagName(trTag)) {
reportError(TablePartRequiredError, &localName, &tdTag.localName());
- e = new HTMLTableCellElement(tdTag, document);
- } else if (current->hasTagName(tableTag)) {
+ e = new HTMLTableCellElement(tdTag, m_document);
+ } else if (m_current->hasTagName(tableTag)) {
// Don't report an error in this case, since making a <tbody> happens all the time when you have <table><tr>,
// and it isn't really a parse error per se.
- e = new HTMLTableSectionElement(tbodyTag, document);
+ e = new HTMLTableSectionElement(tbodyTag, m_document);
} else {
reportError(TablePartRequiredError, &localName, &trTag.localName());
- e = new HTMLTableRowElement(trTag, document);
+ e = new HTMLTableRowElement(trTag, m_document);
}
insertNode(e);
@@ -628,20 +628,20 @@
popBlock(currentTagName);
handled = true;
} else if (!h->hasLocalName(bodyTag)) {
- if (isInline(current)) {
+ if (isInline(m_current)) {
popInlineBlocks();
handled = true;
}
}
- } else if (current->isDocumentNode()) {
+ } else if (m_current->isDocumentNode()) {
if (n->isTextNode()) {
Text* t = static_cast<Text*>(n);
if (t->containsOnlyWhitespace())
return false;
}
- if (!document->documentElement()) {
- e = new HTMLHtmlElement(htmlTag, document);
+ if (!m_document->documentElement()) {
+ e = new HTMLHtmlElement(htmlTag, m_document);
insertNode(e);
handled = true;
}
@@ -649,7 +649,7 @@
// 3. If we couldn't handle the error, just return false and attempt to error-correct again.
if (!handled) {
- reportError(IgnoredContentError, &localName, &current->localName());
+ reportError(IgnoredContentError, &localName, &m_current->localName());
return false;
}
return insertNode(n);
@@ -660,21 +660,21 @@
bool HTMLParser::textCreateErrorCheck(Token* t, RefPtr<Node>& result)
{
- result = new Text(document, t->text.get());
+ result = new Text(m_document, t->text.get());
return false;
}
bool HTMLParser::commentCreateErrorCheck(Token* t, RefPtr<Node>& result)
{
- result = new Comment(document, t->text.get());
+ result = new Comment(m_document, t->text.get());
return false;
}
bool HTMLParser::headCreateErrorCheck(Token*, RefPtr<Node>& result)
{
- if (!head || current->localName() == htmlTag) {
- head = new HTMLHeadElement(headTag, document);
- result = head;
+ if (!m_head || m_current->localName() == htmlTag) {
+ m_head = new HTMLHeadElement(headTag, m_document);
+ result = m_head;
} else
reportError(MisplacedHeadError);
return false;
@@ -683,7 +683,7 @@
bool HTMLParser::bodyCreateErrorCheck(Token*, RefPtr<Node>&)
{
// body no longer allowed if we have a frameset
- if (haveFrameSet)
+ if (m_haveFrameSet)
return false;
popBlock(headTag);
startBody();
@@ -693,19 +693,19 @@
bool HTMLParser::framesetCreateErrorCheck(Token*, RefPtr<Node>&)
{
popBlock(headTag);
- if (inBody && !haveFrameSet && !haveContent) {
+ if (m_inBody && !m_haveFrameSet && !m_haveContent) {
popBlock(bodyTag);
// ### actually for IE document.body returns the now hidden "body" element
// we can't implement that behaviour now because it could cause too many
// regressions and the headaches are not worth the work as long as there is
// no site actually relying on that detail (Dirk)
- if (document->body())
- document->body()->setAttribute(styleAttr, "display:none");
- inBody = false;
+ if (m_document->body())
+ m_document->body()->setAttribute(styleAttr, "display:none");
+ m_inBody = false;
}
- if ((haveContent || haveFrameSet) && current->localName() == htmlTag)
+ if ((m_haveContent || m_haveFrameSet) && m_current->localName() == htmlTag)
return false;
- haveFrameSet = true;
+ m_haveFrameSet = true;
startBody();
return true;
}
@@ -715,7 +715,7 @@
// Only create a new form if we're not already inside one.
// This is consistent with other browsers' behavior.
if (!m_currentFormElement) {
- m_currentFormElement = new HTMLFormElement(formTag, document);
+ m_currentFormElement = new HTMLFormElement(formTag, m_document);
result = m_currentFormElement;
pCloserCreateErrorCheck(t, result);
}
@@ -725,7 +725,7 @@
bool HTMLParser::isindexCreateErrorCheck(Token* t, RefPtr<Node>& result)
{
RefPtr<Node> n = handleIsindex(t);
- if (!inBody)
+ if (!m_inBody)
m_isindexElement = n.release();
else {
t->selfClosingTag = true;
@@ -803,7 +803,7 @@
bool HTMLParser::noscriptCreateErrorCheck(Token*, RefPtr<Node>&)
{
if (!m_isParsingFragment) {
- Settings* settings = document->settings();
+ Settings* settings = m_document->settings();
if (settings && settings->isJavaScriptEnabled())
setSkipMode(noscriptTag);
}
@@ -819,7 +819,7 @@
bool HTMLParser::pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&)
{
- if (document->inCompatMode())
+ if (m_document->inCompatMode())
return true;
if (hasPElementInScope())
popBlock(pTag);
@@ -828,7 +828,7 @@
bool HTMLParser::mapCreateErrorCheck(Token*, RefPtr<Node>& result)
{
- m_currentMapElement = new HTMLMapElement(mapTag, document);
+ m_currentMapElement = new HTMLMapElement(mapTag, m_document);
result = m_currentMapElement;
return false;
}
@@ -899,7 +899,7 @@
if (CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.impl()))
proceed = (this->*errorCheckFunc)(t, result);
if (proceed)
- result = HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, t->tagName, xhtmlNamespaceURI), document, m_currentFormElement.get());
+ result = HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, t->tagName, xhtmlNamespaceURI), m_document, m_currentFormElement.get());
return result.release();
}
@@ -909,7 +909,7 @@
// about 1500 tags, all from a bunch of <b>s. We will only allow at most 20
// nested tags of the same type before just ignoring them all together.
unsigned i = 0;
- for (HTMLStackElem* curr = blockStack;
+ for (HTMLStackElem* curr = m_blockStack;
i < cMaxRedundantTagDepth && curr && curr->tagName == tagName;
curr = curr->next, i++) { }
return i != cMaxRedundantTagDepth;
@@ -932,9 +932,9 @@
else if (t->tagName == pTag)
checkForCloseTagErrors = false;
- HTMLStackElem* oldElem = blockStack;
+ HTMLStackElem* oldElem = m_blockStack;
popBlock(t->tagName, checkForCloseTagErrors);
- if (oldElem == blockStack && t->tagName == pTag) {
+ if (oldElem == m_blockStack && t->tagName == pTag) {
// We encountered a stray </p>. Amazingly Gecko, WinIE, and MacIE all treat
// this as a valid break, i.e., <p></p>. So go ahead and make the empty
// paragraph.
@@ -979,7 +979,7 @@
e->hasLocalName(noembedTag))
return true;
if (e->hasLocalName(noscriptTag) && !m_isParsingFragment) {
- Settings* settings = document->settings();
+ Settings* settings = m_document->settings();
if (settings && settings->isJavaScriptEnabled())
return true;
}
@@ -1050,7 +1050,7 @@
// Find the outermost element that crosses over to a higher level. If there exists another higher-level
// element, we will do another pass, until we have corrected the innermost one.
ExceptionCode ec = 0;
- HTMLStackElem* curr = blockStack;
+ HTMLStackElem* curr = m_blockStack;
HTMLStackElem* prev = 0;
HTMLStackElem* prevMaxElem = 0;
maxElem = 0;
@@ -1074,7 +1074,7 @@
return;
Node* residualElem = prev->node;
- Node* blockElem = prevMaxElem ? prevMaxElem->node : current;
+ Node* blockElem = prevMaxElem ? prevMaxElem->node : m_current;
Node* parentElem = elem->node;
// Check to see if the reparenting that is going to occur is allowed according to the DOM.
@@ -1223,13 +1223,13 @@
// <table><b><i><form></b></form></i></table>
// Then this check will be too simplistic. Right now the <i><form> chain will end up inside the <tbody>, which is pretty crazy.
if (strayTableContent)
- inStrayTableContent--;
+ m_inStrayTableContent--;
// Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>.
// In the above example, Goo should stay italic.
// We cap the number of tags we're willing to reopen based off cResidualStyleMaxDepth.
- HTMLStackElem* curr = blockStack;
+ HTMLStackElem* curr = m_blockStack;
HTMLStackElem* residualStyleStack = 0;
unsigned stackDepth = 1;
unsigned redundantStyleCount = 0;
@@ -1257,7 +1257,7 @@
} else
popOneBlock();
- curr = blockStack;
+ curr = m_blockStack;
}
reopenResidualStyleTags(residualStyleStack, 0); // Stray table content can't be an issue here, since some element above will always become the root of new stray table content.
@@ -1279,7 +1279,7 @@
if (malformedTableParent)
malformedTableParent->insertBefore(newNode, malformedTableParent->lastChild(), ec);
else
- current->appendChild(newNode, ec);
+ m_current->appendChild(newNode, ec);
// FIXME: Is it really OK to ignore the exceptions here?
// Now push a new stack element for this node we just created.
@@ -1288,9 +1288,9 @@
// Set our strayTableContent boolean if needed, so that the reopened tag also knows
// that it is inside a malformed table.
- blockStack->strayTableContent = malformedTableParent != 0;
- if (blockStack->strayTableContent)
- inStrayTableContent++;
+ m_blockStack->strayTableContent = malformedTableParent != 0;
+ if (m_blockStack->strayTableContent)
+ m_inStrayTableContent++;
// Clear our malformed table parent variable.
malformedTableParent = 0;
@@ -1308,8 +1308,8 @@
void HTMLParser::pushBlock(const AtomicString& tagName, int level)
{
- blockStack = new HTMLStackElem(tagName, level, current, didRefCurrent, blockStack);
- didRefCurrent = false;
+ m_blockStack = new HTMLStackElem(tagName, level, m_current, m_didRefCurrent, m_blockStack);
+ m_didRefCurrent = false;
if (tagName == pTag)
m_hasPElementInScope = InScope;
else if (isScopingTag(tagName))
@@ -1318,7 +1318,7 @@
void HTMLParser::popBlock(const AtomicString& tagName, bool reportErrors)
{
- HTMLStackElem* elem = blockStack;
+ HTMLStackElem* elem = m_blockStack;
int maxLevel = 0;
@@ -1346,12 +1346,12 @@
HTMLStackElem* residualStyleStack = 0;
Node* malformedTableParent = 0;
- elem = blockStack;
+ elem = m_blockStack;
unsigned stackDepth = 1;
unsigned redundantStyleCount = 0;
while (elem) {
if (elem->tagName == tagName) {
- int strayTable = inStrayTableContent;
+ int strayTable = m_inStrayTableContent;
popOneBlock();
elem = 0;
@@ -1359,8 +1359,8 @@
// explicit <tbody> or <tr>.
// If we end up needing to reopen residual style tags, the root of the reopened chain
// must also know that it is the root of malformed content inside a <tbody>/<tr>.
- if (strayTable && (inStrayTableContent < strayTable) && residualStyleStack) {
- Node* curr = current;
+ if (strayTable && (m_inStrayTableContent < strayTable) && residualStyleStack) {
+ Node* curr = m_current;
while (curr && !curr->hasTagName(tableTag))
curr = curr->parentNode();
malformedTableParent = curr ? curr->parentNode() : 0;
@@ -1395,7 +1395,7 @@
popOneBlock();
} else
popOneBlock();
- elem = blockStack;
+ elem = m_blockStack;
}
}
@@ -1404,19 +1404,19 @@
inline HTMLStackElem* HTMLParser::popOneBlockCommon()
{
- HTMLStackElem* elem = blockStack;
+ HTMLStackElem* elem = m_blockStack;
// 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->finishParsingChildren();
+ if (m_current && elem->node != m_current)
+ m_current->finishParsingChildren();
- blockStack = elem->next;
- current = elem->node;
- didRefCurrent = elem->didRefNode;
+ m_blockStack = elem->next;
+ m_current = elem->node;
+ m_didRefCurrent = elem->didRefNode;
if (elem->strayTableContent)
- inStrayTableContent--;
+ m_inStrayTableContent--;
if (elem->tagName == pTag)
m_hasPElementInScope = NotInScope;
@@ -1429,8 +1429,8 @@
void HTMLParser::popOneBlock()
{
// Store the current node before popOneBlockCommon overwrites it.
- Node* lastCurrent = current;
- bool didRefLastCurrent = didRefCurrent;
+ Node* lastCurrent = m_current;
+ bool didRefLastCurrent = m_didRefCurrent;
delete popOneBlockCommon();
@@ -1444,8 +1444,8 @@
// See the two callers for details.
// Store the current node before popOneBlockCommon overwrites it.
- Node* lastCurrent = current;
- bool didRefLastCurrent = didRefCurrent;
+ Node* lastCurrent = m_current;
+ bool didRefLastCurrent = m_didRefCurrent;
// Pop the block, but don't deref the current node as popOneBlock does because
// we'll be using the pointer in the new stack element.
@@ -1453,7 +1453,7 @@
// Transfer the current node into the stack element.
// No need to deref the old elem->node because popOneBlockCommon transferred
- // it into the current/didRefCurrent fields.
+ // it into the m_current/m_didRefCurrent fields.
elem->node = lastCurrent;
elem->didRefNode = didRefLastCurrent;
elem->next = head;
@@ -1463,7 +1463,7 @@
void HTMLParser::checkIfHasPElementInScope()
{
m_hasPElementInScope = NotInScope;
- HTMLStackElem* elem = blockStack;
+ HTMLStackElem* elem = m_blockStack;
while (elem) {
const AtomicString& tagName = elem->tagName;
if (tagName == pTag) {
@@ -1477,42 +1477,42 @@
void HTMLParser::popInlineBlocks()
{
- while (blockStack && isInline(current))
+ while (m_blockStack && isInline(m_current))
popOneBlock();
}
void HTMLParser::freeBlock()
{
- while (blockStack)
+ while (m_blockStack)
popOneBlock();
}
void HTMLParser::createHead()
{
- if (head || !document->documentElement())
+ if (m_head || !m_document->documentElement())
return;
- head = new HTMLHeadElement(headTag, document);
- HTMLElement* body = document->body();
+ m_head = new HTMLHeadElement(headTag, m_document);
+ HTMLElement* body = m_document->body();
ExceptionCode ec = 0;
- document->documentElement()->insertBefore(head, body, ec);
+ m_document->documentElement()->insertBefore(m_head, body, ec);
if (ec)
- head = 0;
+ m_head = 0;
// If the body does not exist yet, then the <head> should be pushed as the current block.
- if (head && !body) {
- pushBlock(head->localName(), head->tagPriority());
- setCurrent(head);
+ if (m_head && !body) {
+ pushBlock(m_head->localName(), m_head->tagPriority());
+ setCurrent(m_head);
}
}
PassRefPtr<Node> HTMLParser::handleIsindex(Token* t)
{
- RefPtr<Node> n = new HTMLDivElement(divTag, document);
+ RefPtr<Node> n = new HTMLDivElement(divTag, m_document);
NamedMappedAttrMap* attrs = t->attrs.get();
- RefPtr<HTMLIsIndexElement> isIndex = new HTMLIsIndexElement(isindexTag, document, m_currentFormElement.get());
+ RefPtr<HTMLIsIndexElement> isIndex = new HTMLIsIndexElement(isindexTag, m_document, m_currentFormElement.get());
isIndex->setAttributeMap(attrs);
isIndex->setAttribute(typeAttr, "khtml_isindex");
@@ -1523,20 +1523,20 @@
t->attrs = 0;
}
- n->addChild(new HTMLHRElement(hrTag, document));
- n->addChild(new Text(document, text));
+ n->addChild(new HTMLHRElement(hrTag, m_document));
+ n->addChild(new Text(m_document, text));
n->addChild(isIndex.release());
- n->addChild(new HTMLHRElement(hrTag, document));
+ n->addChild(new HTMLHRElement(hrTag, m_document));
return n.release();
}
void HTMLParser::startBody()
{
- if (inBody)
+ if (m_inBody)
return;
- inBody = true;
+ m_inBody = true;
if (m_isindexElement) {
insertNode(m_isindexElement.get(), true /* don't descend into this node */);
@@ -1547,8 +1547,8 @@
void HTMLParser::finished()
{
// In the case of a completely empty document, here's the place to create the HTML element.
- if (current && current->isDocumentNode() && !document->documentElement())
- insertNode(new HTMLHtmlElement(htmlTag, document));
+ if (m_current && m_current->isDocumentNode() && !m_document->documentElement())
+ insertNode(new HTMLHtmlElement(htmlTag, m_document));
// This ensures that "current" is not left pointing to a node when the document is destroyed.
freeBlock();
@@ -1556,16 +1556,16 @@
// Warning, this may delete the tokenizer and parser, so don't try to do anything else after this.
if (!m_isParsingFragment)
- document->finishedParsing();
+ m_document->finishedParsing();
}
void HTMLParser::reportErrorToConsole(HTMLParserErrorCode errorCode, const AtomicString* tagName1, const AtomicString* tagName2, bool closeTags)
{
- Frame* frame = document->frame();
+ Frame* frame = m_document->frame();
if (!frame)
return;
- HTMLTokenizer* htmlTokenizer = static_cast<HTMLTokenizer*>(document->tokenizer());
+ HTMLTokenizer* htmlTokenizer = static_cast<HTMLTokenizer*>(m_document->tokenizer());
int lineNumber = htmlTokenizer->lineNumber() + 1;
AtomicString tag1;
@@ -1600,7 +1600,7 @@
frame->domWindow()->console()->addMessage(HTMLMessageSource,
isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel,
- message, lineNumber, document->url().string());
+ message, lineNumber, m_document->url().string());
}
}
« no previous file with comments | « third_party/WebKit/WebCore/html/HTMLParser.h ('k') | third_party/WebKit/WebCore/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698