Introduce PointerEvent-related definitions

* Resolves https://youtrack.jetbrains.com/issue/KT-23932
 * Backed by review https://upsource.jetbrains.com/kotlin/branch/KT-23932-POINTER-EVENT-FROM-REMOTE-IDL
This commit is contained in:
Shagen Ogandzhanian
2018-12-12 14:50:03 +01:00
parent 2d49268a0b
commit 44da3c89b7
17 changed files with 233 additions and 9 deletions
@@ -24,6 +24,8 @@ val urls = listOf(
"http://www.w3.org/TR/geometry-1/" to "org.w3c.dom",
"http://www.w3.org/TR/cssom-view/" to "org.w3c.dom",
"http://www.w3.org/TR/uievents/" to "org.w3c.dom.events",
"http://www.w3.org/TR/pointerevents/" to "org.w3c.dom.pointerevents",
"https://drafts.csswg.org/cssom/" to "org.w3c.dom.css",
"http://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
"https://raw.githubusercontent.com/whatwg/url/master/url.html" to "org.w3c.dom.url",
@@ -49,15 +49,18 @@ fun main(args: Array<String>) {
w.appendln()
w.appendln()
e.value.forEach { pair ->
val (url) = pair
e.value.forEach { (url) ->
println("Loading $url...")
w.appendln("// Downloaded from $url")
if (url.endsWith(".idl")) {
w.appendln(URL(url).readText())
} else {
extractIDLText(url, w)
val content = fetch(url)
if (content != null) {
if (url.endsWith(".idl")) {
w.appendln(content)
} else {
extractIDLText(content, w)
}
}
}
@@ -66,9 +69,18 @@ fun main(args: Array<String>) {
}
}
private fun extractIDLText(url: String, out: Appendable) {
// val soup = Jsoup.connect(url).validateTLSCertificates(false).ignoreHttpErrors(true).get()
val soup = Jsoup.parse(URL(url).readText())
private fun fetch(url: String): String? {
try {
return URL(url).readText()
} catch (e: Exception) {
println("failed to download ${url}, if it's not a local problem, revisit the list of downloaded entities")
e.printStackTrace()
return null
}
}
private fun extractIDLText(rawContent: String, out: Appendable) {
val soup = Jsoup.parse(rawContent)
fun append(it : Element) {
if (!it.tag().preserveWhitespace()) {
return append(Element(Tag.valueOf("pre"), it.baseUri()).appendChild(it))