3ea1dc8e65cf405779e2e704d03ca6fd2423add9
[opendreambox.git] / 0002-Qt-Add-HbbTv-MIME-types.patch
1 From 8dac0c9a294996cdc95666cde57a00f7c15a0f15 Mon Sep 17 00:00:00 2001
2 From: Stephan Reichholf <stephan.reichholf@dream-property.net>
3 Date: Wed, 28 Mar 2012 13:52:55 +0200
4 Subject: [PATCH 2/2] Qt: Add HbbTv MIME types
5
6 ---
7  .../Source/WebCore/dom/DOMImplementation.cpp       |    6 +++++-
8  .../Source/WebCore/dom/ProcessingInstruction.cpp   |    3 ++-
9  .../WebCore/dom/XMLDocumentParserLibxml2.cpp       |    1 +
10  .../Source/WebCore/dom/XMLDocumentParserQt.cpp     |    1 +
11  .../webkit/Source/WebCore/loader/FrameLoader.cpp   |    4 ++--
12  .../WebCore/loader/cache/CachedXSLStyleSheet.cpp   |    2 +-
13  .../Source/WebCore/platform/MIMETypeRegistry.cpp   |    5 ++++-
14  .../WebCore/platform/qt/MIMETypeRegistryQt.cpp     |    3 +++
15  8 files changed, 19 insertions(+), 6 deletions(-)
16
17 diff --git a/src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.cpp b/src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.cpp
18 index c258a29..e33db09 100644
19 --- a/src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.cpp
20 +++ b/src/3rdparty/webkit/Source/WebCore/dom/DOMImplementation.cpp
21 @@ -274,7 +274,8 @@ PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&,
22  
23  bool DOMImplementation::isXMLMIMEType(const String& mimeType)
24  {
25 -    if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl")
26 +    if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl" || 
27 +          mimeType == "application/vnd.hbbtv.xhtml+xml" || mimeType == "application/ce-html+xml" || mimeType == "application/x-ce-html+xml")
28          return true;
29      static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
30      DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$", TextCaseSensitive));
31 @@ -311,6 +312,9 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame
32      if (type == "text/html")
33          return HTMLDocument::create(frame, url);
34      if (type == "application/xhtml+xml"
35 +       || type == "application/vnd.hbbtv.xhtml+xml"
36 +       || type == "application/ce-html+xml"
37 +       || type == "application/x-ce-html+xml"
38  #if ENABLE(XHTMLMP)
39          || type == "application/vnd.wap.xhtml+xml"
40  #endif
41 diff --git a/src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.cpp b/src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.cpp
42 index f7dcfd2..f20aab0 100644
43 --- a/src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.cpp
44 +++ b/src/3rdparty/webkit/Source/WebCore/dom/ProcessingInstruction.cpp
45 @@ -127,7 +127,8 @@ void ProcessingInstruction::checkStyleSheet()
46          m_isCSS = type.isEmpty() || type == "text/css";
47  #if ENABLE(XSLT)
48          m_isXSL = (type == "text/xml" || type == "text/xsl" || type == "application/xml" ||
49 -                   type == "application/xhtml+xml" || type == "application/rss+xml" || type == "application/atom+xml");
50 +                   type == "application/xhtml+xml" || type == "application/rss+xml" || type == "application/atom+xml" ||
51 +                   type == "application/vnd.hbbtv.xhtml+xml" || type == "application/ce-html+xml" || type == "application/x-ce-html+xml");
52          if (!m_isCSS && !m_isXSL)
53  #else
54          if (!m_isCSS)
55 diff --git a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
56 index e82bf89..c2eb2ec 100644
57 --- a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
58 +++ b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
59 @@ -1266,6 +1266,7 @@ static void externalSubsetHandler(void* closure, const xmlChar*, const xmlChar*
60          || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN")
61          || (extId == "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN")
62          || (extId == "-//WAPFORUM//DTD XHTML Mobile 1.0//EN")
63 +        || (extId == "-//HbbTV//1.1.1//EN")
64         )
65          getParser(closure)->setIsXHTMLDocument(true); // controls if we replace entities or not.
66  }
67 diff --git a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp
68 index dc72276..8a5760f 100644
69 --- a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp
70 +++ b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParserQt.cpp
71 @@ -696,6 +696,7 @@ void XMLDocumentParser::parseDtd()
72          || (publicId == QLatin1String("-//W3C//DTD XHTML Basic 1.0//EN"))
73          || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"))
74          || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"))
75 +        || (publicId == QLatin1String("-//HbbTV//1.1.1//EN"))
76  #if !ENABLE(XHTMLMP)
77          || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN"))
78  #endif
79 diff --git a/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp
80 index 4bef249..01ba5d7 100644
81 --- a/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp
82 +++ b/src/3rdparty/webkit/Source/WebCore/loader/FrameLoader.cpp
83 @@ -129,9 +129,9 @@ using namespace SVGNames;
84  #endif
85  
86  #if ENABLE(XHTMLMP)
87 -static const char defaultAcceptHeader[] = "application/vnd.wap.xhtml+xml,application/xhtml+xml;profile='http://www.wapforum.org/xhtml',text/html,application/xml;q=0.9,*/*;q=0.8";
88 +static const char defaultAcceptHeader[] = "application/vnd.hbbtv.xhtml+xml,application/ce-html+xml,application/x-ce-html+xml,application/vnd.wap.xhtml+xml,application/xhtml+xml;profile='http://www.wapforum.org/xhtml',text/html,application/xml;q=0.9,*/*;q=0.8";
89  #else
90 -static const char defaultAcceptHeader[] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
91 +static const char defaultAcceptHeader[] = "application/vnd.hbbtv.xhtml+xml,application/ce-html+xml,application/x-ce-html+xml,application/ce-html+xml,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
92  #endif
93  
94  static double storedTimeOfLastCompletedLoad;
95 diff --git a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
96 index ca7bf13..7030dd2 100644
97 --- a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
98 +++ b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
99 @@ -43,7 +43,7 @@ CachedXSLStyleSheet::CachedXSLStyleSheet(const String &url)
100  {
101      // It's XML we want.
102      // FIXME: This should accept more general xml formats */*+xml, image/svg+xml for example.
103 -    setAccept("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml");
104 +    setAccept("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml, application/vnd.hbbtv.xhtml+xml, application/ce-html+xml, application/x-ce-html+xml");
105  }
106  
107  void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c)
108 diff --git a/src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.cpp b/src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.cpp
109 index c8fee4f..00a469e 100644
110 --- a/src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.cpp
111 +++ b/src/3rdparty/webkit/Source/WebCore/platform/MIMETypeRegistry.cpp
112 @@ -205,6 +205,9 @@ static void initializeSupportedNonImageMimeTypes()
113          "text/",
114          "application/xml",
115          "application/xhtml+xml",
116 +        "application/vnd.hbbtv.xhtml+xml",
117 +        "application/ce-html+xml",
118 +        "application/x-ce-html+xml",
119          "application/vnd.wap.xhtml+xml",
120          "application/rss+xml",
121          "application/atom+xml",
122 @@ -219,7 +222,7 @@ static void initializeSupportedNonImageMimeTypes()
123          // Note: ADDING a new type here will probably render it as HTML. This can
124          // result in cross-site scripting.
125      };
126 -    COMPILE_ASSERT(sizeof(types) / sizeof(types[0]) <= 16,
127 +    COMPILE_ASSERT(sizeof(types) / sizeof(types[0]) <= 24,
128                     nonimage_mime_types_must_be_less_than_or_equal_to_16);
129  
130      for (size_t i = 0; i < WTF_ARRAY_LENGTH(types); ++i)
131 diff --git a/src/3rdparty/webkit/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/src/3rdparty/webkit/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
132 index 01cef12..b82ef14 100644
133 --- a/src/3rdparty/webkit/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
134 +++ b/src/3rdparty/webkit/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
135 @@ -66,6 +66,9 @@ static const ExtensionMap extensionMap[] = {
136      { "xpm", "image/x-xpm" },
137      { "xsl", "text/xsl" },
138      { "xhtml", "application/xhtml+xml" },
139 +    { "hbbtv", "application/vnd.hbbtv.xhtml+xml" },
140 +    { "cehtml", "application/ce-html+xml" },
141 +    { "xcehtml", "application/x-ce-html+xml" },
142      { "wml", "text/vnd.wap.wml" },
143      { "wmlc", "application/vnd.wap.wmlc" },
144      { 0, 0 }
145 -- 
146 1.7.5.4
147