Diff
Modified: trunk/Source/WebCore/ChangeLog (123580 => 123581)
--- trunk/Source/WebCore/ChangeLog 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/ChangeLog 2012-07-25 06:52:43 UTC (rev 123581)
@@ -1,3 +1,59 @@
+2012-07-24 Kwang Yul Seo <[email protected]>
+
+ Remove anonymous namespace and make functions static.
+ https://bugs.webkit.org/show_bug.cgi?id=92214
+
+ Reviewed by Adam Barth.
+
+ Mark functions as static instead of enclosing them in anonymous namespaces.
+ One exception to this rule is when a function is passed as a template argument.
+ In this case, the function must have an external linkage.
+
+ No functional change. Covered by existing tests.
+
+ * html/parser/HTMLConstructionSite.cpp:
+ (WebCore::hasImpliedEndTag):
+ (WebCore::causesFosterParenting):
+ (WebCore::isAllWhitespace):
+ * html/parser/HTMLDocumentParser.cpp:
+ (WebCore):
+ (WebCore::tokenizerStateForContextElement):
+ * html/parser/HTMLElementStack.cpp:
+ (WebCore::isNumberedHeaderElement):
+ (WebCore::isRootNode):
+ (WebCore):
+ * html/parser/HTMLEntityParser.cpp:
+ (WebCore::isAlphaNumeric):
+ * html/parser/HTMLEntitySearch.cpp:
+ (WebCore::halfway):
+ * html/parser/HTMLPreloadScanner.cpp:
+ (WebCore):
+ * html/parser/HTMLTokenizer.cpp:
+ (WebCore::toLowerCase):
+ (WebCore::vectorEqualsString):
+ (WebCore::isEndTagBufferingState):
+ * html/parser/HTMLTreeBuilder.cpp:
+ (WebCore):
+ (WebCore::uninitializedPositionValue1):
+ (WebCore::isAllWhitespace):
+ (WebCore::isAllWhitespaceOrReplacementCharacters):
+ (WebCore::isNumberedHeaderTag):
+ (WebCore::isCaptionColOrColgroupTag):
+ (WebCore::isTableCellContextTag):
+ (WebCore::isTableBodyContextTag):
+ (WebCore::isSpecialNode):
+ (WebCore::isNonAnchorNonNobrFormattingTag):
+ (WebCore::isNonAnchorFormattingTag):
+ (WebCore::isFormattingTag):
+ (WebCore::closestFormAncestor):
+ (WebCore::mapLoweredLocalNameToName):
+ (WebCore::adjustSVGTagNameCase):
+ (WebCore::adjustAttributes):
+ (WebCore::adjustSVGAttributes):
+ (WebCore::adjustMathMLAttributes):
+ (WebCore::addNamesWithPrefix):
+ (WebCore::adjustForeignAttributes):
+
2012-07-24 Vsevolod Vlasov <[email protected]>
Unreviewed r123494 follow-up: fixed inspector undock icon.
Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -58,9 +58,7 @@
using namespace HTMLNames;
-namespace {
-
-bool hasImpliedEndTag(const HTMLStackItem* item)
+static bool hasImpliedEndTag(const HTMLStackItem* item)
{
return item->hasTagName(ddTag)
|| item->hasTagName(dtTag)
@@ -72,7 +70,7 @@
|| item->hasTagName(rtTag);
}
-bool causesFosterParenting(const HTMLStackItem* item)
+static bool causesFosterParenting(const HTMLStackItem* item)
{
return item->hasTagName(tableTag)
|| item->hasTagName(tbodyTag)
@@ -81,13 +79,11 @@
|| item->hasTagName(trTag);
}
-inline bool isAllWhitespace(const String& string)
+static inline bool isAllWhitespace(const String& string)
{
return string.isAllSpecialCharacters<isHTMLSpace>();
}
-} // namespace
-
static inline void executeTask(HTMLConstructionSiteTask& task)
{
if (task.nextChild)
Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -45,11 +45,9 @@
using namespace HTMLNames;
-namespace {
-
// This is a direct transcription of step 4 from:
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case
-HTMLTokenizerState::State tokenizerStateForContextElement(Element* contextElement, bool reportErrors)
+static HTMLTokenizerState::State tokenizerStateForContextElement(Element* contextElement, bool reportErrors)
{
if (!contextElement)
return HTMLTokenizerState::DataState;
@@ -72,8 +70,6 @@
return HTMLTokenizerState::DataState;
}
-} // namespace
-
HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors)
: ScriptableDocumentParser(document)
, m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(document)))
Modified: trunk/Source/WebCore/html/parser/HTMLElementStack.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLElementStack.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLElementStack.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -38,9 +38,7 @@
using namespace HTMLNames;
-namespace {
-
-inline bool isNumberedHeaderElement(HTMLStackItem* item)
+static inline bool isNumberedHeaderElement(HTMLStackItem* item)
{
return item->hasTagName(h1Tag)
|| item->hasTagName(h2Tag)
@@ -50,12 +48,14 @@
|| item->hasTagName(h6Tag);
}
-inline bool isRootNode(HTMLStackItem* item)
+static inline bool isRootNode(HTMLStackItem* item)
{
return item->isDocumentFragmentNode()
|| item->hasTagName(htmlTag);
}
+namespace {
+
inline bool isScopeMarker(HTMLStackItem* item)
{
return item->hasTagName(appletTag)
Modified: trunk/Source/WebCore/html/parser/HTMLEntityParser.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLEntityParser.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLEntityParser.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -37,8 +37,6 @@
namespace WebCore {
-namespace {
-
static const UChar windowsLatin1ExtensionArray[32] = {
0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, // 80-87
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F, // 88-8F
@@ -46,7 +44,7 @@
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178, // 98-9F
};
-inline bool isAlphaNumeric(UChar cc)
+static inline bool isAlphaNumeric(UChar cc)
{
return (cc >= '0' && cc <= '9') || (cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z');
}
@@ -137,8 +135,6 @@
}
};
-}
-
bool consumeHTMLEntity(SegmentedString& source, StringBuilder& decodedEntity, bool& notEnoughCharacters, UChar additionalAllowedCharacter)
{
return consumeCharacterReference<HTMLEntityParser>(source, decodedEntity, notEnoughCharacters, additionalAllowedCharacter);
Modified: trunk/Source/WebCore/html/parser/HTMLEntitySearch.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLEntitySearch.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLEntitySearch.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -30,15 +30,11 @@
namespace WebCore {
-namespace {
-
-const HTMLEntityTableEntry* halfway(const HTMLEntityTableEntry* left, const HTMLEntityTableEntry* right)
+static const HTMLEntityTableEntry* halfway(const HTMLEntityTableEntry* left, const HTMLEntityTableEntry* right)
{
return &left[(right - left) / 2];
}
-}
-
HTMLEntitySearch::HTMLEntitySearch()
: m_currentLength(0)
, m_mostRecentMatch(0)
Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -43,8 +43,6 @@
using namespace HTMLNames;
-namespace {
-
class PreloadTask {
public:
explicit PreloadTask(const HTMLToken& token)
@@ -151,8 +149,6 @@
bool m_inputIsImage;
};
-} // namespace
-
HTMLPreloadScanner::HTMLPreloadScanner(Document* document)
: m_document(document)
, m_cssScanner(document)
Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -67,16 +67,14 @@
return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag;
}
-namespace {
-
-inline UChar toLowerCase(UChar cc)
+static inline UChar toLowerCase(UChar cc)
{
ASSERT(isASCIIUpper(cc));
const int lowerCaseOffset = 0x20;
return cc + lowerCaseOffset;
}
-inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string)
+static inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string)
{
if (vector.size() != string.length())
return false;
@@ -86,7 +84,7 @@
return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar));
}
-inline bool isEndTagBufferingState(HTMLTokenizerState::State state)
+static inline bool isEndTagBufferingState(HTMLTokenizerState::State state)
{
switch (state) {
case HTMLTokenizerState::RCDATAEndTagOpenState:
@@ -103,8 +101,6 @@
}
}
-}
-
#define HTML_BEGIN_STATE(stateName) BEGIN_STATE(HTMLTokenizerState, stateName)
#define HTML_RECONSUME_IN(stateName) RECONSUME_IN(HTMLTokenizerState, stateName)
#define HTML_ADVANCE_TO(stateName) ADVANCE_TO(HTMLTokenizerState, stateName)
Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (123580 => 123581)
--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2012-07-25 06:40:49 UTC (rev 123580)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2012-07-25 06:52:43 UTC (rev 123581)
@@ -57,11 +57,6 @@
using namespace HTMLNames;
-static TextPosition uninitializedPositionValue1()
-{
- return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first());
-}
-
namespace {
inline bool isHTMLSpaceOrReplacementCharacter(UChar character)
@@ -69,17 +64,24 @@
return isHTMLSpace(character) || character == replacementCharacter;
}
-inline bool isAllWhitespace(const String& string)
+}
+
+static TextPosition uninitializedPositionValue1()
{
+ return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first());
+}
+
+static inline bool isAllWhitespace(const String& string)
+{
return string.isAllSpecialCharacters<isHTMLSpace>();
}
-inline bool isAllWhitespaceOrReplacementCharacters(const String& string)
+static inline bool isAllWhitespaceOrReplacementCharacters(const String& string)
{
return string.isAllSpecialCharacters<isHTMLSpaceOrReplacementCharacter>();
}
-bool isNumberedHeaderTag(const AtomicString& tagName)
+static bool isNumberedHeaderTag(const AtomicString& tagName)
{
return tagName == h1Tag
|| tagName == h2Tag
@@ -89,19 +91,19 @@
|| tagName == h6Tag;
}
-bool isCaptionColOrColgroupTag(const AtomicString& tagName)
+static bool isCaptionColOrColgroupTag(const AtomicString& tagName)
{
return tagName == captionTag
|| tagName == colTag
|| tagName == colgroupTag;
}
-bool isTableCellContextTag(const AtomicString& tagName)
+static bool isTableCellContextTag(const AtomicString& tagName)
{
return tagName == thTag || tagName == tdTag;
}
-bool isTableBodyContextTag(const AtomicString& tagName)
+static bool isTableBodyContextTag(const AtomicString& tagName)
{
return tagName == tbodyTag
|| tagName == tfootTag
@@ -109,7 +111,7 @@
}
// http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#special
-bool isSpecialNode(const HTMLStackItem* item)
+static bool isSpecialNode(const HTMLStackItem* item)
{
if (item->hasTagName(MathMLNames::miTag)
|| item->hasTagName(MathMLNames::moTag)
@@ -200,7 +202,7 @@
|| tagName == xmpTag;
}
-bool isNonAnchorNonNobrFormattingTag(const AtomicString& tagName)
+static bool isNonAnchorNonNobrFormattingTag(const AtomicString& tagName)
{
return tagName == bTag
|| tagName == bigTag
@@ -216,19 +218,19 @@
|| tagName == uTag;
}
-bool isNonAnchorFormattingTag(const AtomicString& tagName)
+static bool isNonAnchorFormattingTag(const AtomicString& tagName)
{
return tagName == nobrTag
|| isNonAnchorNonNobrFormattingTag(tagName);
}
// http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#formatting
-bool isFormattingTag(const AtomicString& tagName)
+static bool isFormattingTag(const AtomicString& tagName)
{
return tagName == aTag || isNonAnchorFormattingTag(tagName);
}
-HTMLFormElement* closestFormAncestor(Element* element)
+static HTMLFormElement* closestFormAncestor(Element* element)
{
while (element) {
if (element->hasTagName(formTag))
@@ -241,8 +243,6 @@
return 0;
}
-} // namespace
-
class HTMLTreeBuilder::ExternalCharacterTokenBuffer {
WTF_MAKE_NONCOPYABLE(ExternalCharacterTokenBuffer);
public:
@@ -638,11 +638,9 @@
m_tree.insertHTMLElement(token);
}
-namespace {
-
typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap;
-void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, QualifiedName** names, size_t length)
+static void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, QualifiedName** names, size_t length)
{
for (size_t i = 0; i < length; ++i) {
const QualifiedName& name = *names[i];
@@ -653,7 +651,7 @@
}
}
-void adjustSVGTagNameCase(AtomicHTMLToken* token)
+static void adjustSVGTagNameCase(AtomicHTMLToken* token)
{
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
@@ -670,7 +668,7 @@
}
template<QualifiedName** getAttrs(size_t* length)>
-void adjustAttributes(AtomicHTMLToken* token)
+static void adjustAttributes(AtomicHTMLToken* token)
{
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
@@ -688,17 +686,17 @@
}
}
-void adjustSVGAttributes(AtomicHTMLToken* token)
+static void adjustSVGAttributes(AtomicHTMLToken* token)
{
adjustAttributes<SVGNames::getSVGAttrs>(token);
}
-void adjustMathMLAttributes(AtomicHTMLToken* token)
+static void adjustMathMLAttributes(AtomicHTMLToken* token)
{
adjustAttributes<MathMLNames::getMathMLAttrs>(token);
}
-void addNamesWithPrefix(PrefixedNameToQualifiedNameMap* map, const AtomicString& prefix, QualifiedName** names, size_t length)
+static void addNamesWithPrefix(PrefixedNameToQualifiedNameMap* map, const AtomicString& prefix, QualifiedName** names, size_t length)
{
for (size_t i = 0; i < length; ++i) {
QualifiedName* name = names[i];
@@ -709,7 +707,7 @@
}
}
-void adjustForeignAttributes(AtomicHTMLToken* token)
+static void adjustForeignAttributes(AtomicHTMLToken* token)
{
static PrefixedNameToQualifiedNameMap* map = 0;
if (!map) {
@@ -733,8 +731,6 @@
}
}
-}
-
void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
{
ASSERT(token->type() == HTMLTokenTypes::StartTag);