[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
abarth at webkit.org
abarth at webkit.org
Wed Dec 22 12:07:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 288ad1bc6ffb9f05ff8904fa13ec883a0d60b396
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Aug 16 01:48:54 2010 +0000
2010-08-15 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Port Chromium's WebEntities to HTMLEntityTable
https://bugs.webkit.org/show_bug.cgi?id=44036
This code is wrong and needs to be removed. However, at least after
this patch, it will compile.
* src/WebEntities.cpp:
(WebKit::):
(WebKit::WebEntities::WebEntities):
* src/WebEntities.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index a43139f..a3aa749 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-15 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Port Chromium's WebEntities to HTMLEntityTable
+ https://bugs.webkit.org/show_bug.cgi?id=44036
+
+ This code is wrong and needs to be removed. However, at least after
+ this patch, it will compile.
+
+ * src/WebEntities.cpp:
+ (WebKit::):
+ (WebKit::WebEntities::WebEntities):
+ * src/WebEntities.h:
+
2010-08-13 Satish Sampath <satish at chromium.org>
Reviewed by Jeremy Orlow.
diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp
index 30b619b..d845b71 100644
--- a/WebKit/chromium/src/WebEntities.cpp
+++ b/WebKit/chromium/src/WebEntities.cpp
@@ -33,6 +33,7 @@
#include <string.h>
+#include "HTMLEntityTable.h"
#include "PlatformString.h"
#include "StringBuilder.h"
#include <wtf/HashMap.h>
@@ -41,59 +42,51 @@
using namespace WebCore;
+namespace WebKit {
+
namespace {
-// Note that this file is also included by LegacyHTMLDocumentParser.cpp so we are getting
-// two copies of the data in memory. We can fix this by changing the script
-// that generated the array to create a static const that is its length, but
-// this is low priority since the data is less than 4K. We use anonymous
-// namespace to prevent name collisions.
-#include "HTMLEntityNames.cpp" // NOLINT
-}
-namespace WebKit {
+void populateMapFromXMLEntities(WTF::HashMap<int, WTF::String>& map)
+{
+ ASSERT(map.isEmpty());
+ map.set(0x003c, "lt");
+ map.set(0x003e, "gt");
+ map.set(0x0026, "amp");
+ map.set(0x0027, "apos");
+ map.set(0x0022, "quot");
+}
-void populateMap(WTF::HashMap<int, WTF::String>& map,
- const Entity* entities,
- size_t entitiesCount,
- bool standardHTML)
+void populateMapFromHTMLEntityTable(WTF::HashMap<int, WTF::String>& map)
{
ASSERT(map.isEmpty());
- const Entity* entity = &entities[0];
- for (size_t i = 0; i < entitiesCount; i++, entity++) {
- int code = entity->code;
- String name = entity->name;
- // For consistency, use the lowe case for entities that have both.
- if (map.contains(code) && map.get(code) == name.lower())
+ const HTMLEntityTableEntry* entry = HTMLEntityTable::firstEntry();
+ const HTMLEntityTableEntry* end = HTMLEntityTable::lastEntry() + 1;
+ while (entry != end) {
+ String entity = entry->entity;
+ int value = entry->value;
+ ASSERT(value && !entity.isEmpty());
+ if (entity[entity.length() - 1] != ';')
+ continue; // We want the canonical version that ends in ;
+ // For consistency, use the lower case for entities that have both.
+ if (map.contains(value) && map.get(value) == entity.lower())
continue;
- // Don't register %, ⊅ and &supl;.
- if (standardHTML && (code == '%' || code == 0x2285 || code == 0x00b9))
+ // Don't register %, ⊅ and &supl; for some unknown reason.
+ if (value == '%' || value == 0x2285 || value == 0x00b9)
continue;
- map.set(code, name);
+ map.set(value, entity);
}
- if (standardHTML)
- map.set(static_cast<int>(0x0027), String("#39"));
+ // We add #39 for some unknown reason.
+ map.set(0x0027, String("#39"));
}
-static const Entity xmlBuiltInEntityCodes[] = {
- { "lt", 0x003c },
- { "gt", 0x003e },
- { "amp", 0x0026 },
- { "apos", 0x0027 },
- { "quot", 0x0022 }
-};
+}
WebEntities::WebEntities(bool xmlEntities)
{
if (xmlEntities)
- populateMap(m_entitiesMap,
- xmlBuiltInEntityCodes,
- sizeof(xmlBuiltInEntityCodes) / sizeof(Entity),
- false);
+ populateMapFromXMLEntities(m_entitiesMap);
else
- populateMap(m_entitiesMap,
- wordlist,
- sizeof(wordlist) / sizeof(Entity),
- true);
+ populateMapFromHTMLEntityTable(m_entitiesMap);
}
String WebEntities::entityNameByCode(int code) const
diff --git a/WebKit/chromium/src/WebEntities.h b/WebKit/chromium/src/WebEntities.h
index a01cc5d..f210566 100644
--- a/WebKit/chromium/src/WebEntities.h
+++ b/WebKit/chromium/src/WebEntities.h
@@ -36,6 +36,7 @@
namespace WebKit {
+// FIXME: This class is wrong and needs to be removed.
class WebEntities {
public:
// ', %, ⊅, &supl; are not defined by the HTML standards.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list