| File: | Source/WebKitLegacy/mac/DOM/DOMDocument.mm |
| Warning: | line 167, column 16 Call argument uses a forward declared type 'WebCore::WindowProxy *' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (C) 2004-2016 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #import "DOMDocumentInternal.h" |
| 27 | |
| 28 | #import "DOMAbstractViewInternal.h" |
| 29 | #import "DOMAttrInternal.h" |
| 30 | #import "DOMCDATASectionInternal.h" |
| 31 | #import "DOMCSSRuleListInternal.h" |
| 32 | #import "DOMCSSStyleDeclarationInternal.h" |
| 33 | #import "DOMCommentInternal.h" |
| 34 | #import "DOMCustomXPathNSResolver.h" |
| 35 | #import "DOMDocumentFragmentInternal.h" |
| 36 | #import "DOMDocumentTypeInternal.h" |
| 37 | #import "DOMElementInternal.h" |
| 38 | #import "DOMEventInternal.h" |
| 39 | #import "DOMHTMLCollectionInternal.h" |
| 40 | #import "DOMHTMLElementInternal.h" |
| 41 | #import "DOMHTMLHeadElementInternal.h" |
| 42 | #import "DOMHTMLScriptElementInternal.h" |
| 43 | #import "DOMImplementationInternal.h" |
| 44 | #import "DOMInternal.h" |
| 45 | #import "DOMNodeInternal.h" |
| 46 | #import "DOMNodeIteratorInternal.h" |
| 47 | #import "DOMNodeListInternal.h" |
| 48 | #import "DOMProcessingInstructionInternal.h" |
| 49 | #import "DOMRangeInternal.h" |
| 50 | #import "DOMStyleSheetListInternal.h" |
| 51 | #import "DOMTextInternal.h" |
| 52 | #import "DOMTreeWalkerInternal.h" |
| 53 | #import "DOMXPathExpressionInternal.h" |
| 54 | #import "DOMXPathResultInternal.h" |
| 55 | #import "ExceptionHandlers.h" |
| 56 | #import "ObjCNodeFilterCondition.h" |
| 57 | #import <WebCore/Attr.h> |
| 58 | #import <WebCore/CDATASection.h> |
| 59 | #import <WebCore/CSSRuleList.h> |
| 60 | #import <WebCore/CSSStyleProperties.h> |
| 61 | #import <WebCore/Comment.h> |
| 62 | #import <WebCore/CustomElementRegistry.h> |
| 63 | #import <WebCore/DocumentFragment.h> |
| 64 | #import <WebCore/DocumentFullscreen.h> |
| 65 | #import <WebCore/DocumentInlines.h> |
| 66 | #import <WebCore/DocumentType.h> |
| 67 | #import <WebCore/Event.h> |
| 68 | #import <WebCore/HTMLCollection.h> |
| 69 | #import <WebCore/HTMLHeadElement.h> |
| 70 | #import <WebCore/HTMLScriptElement.h> |
| 71 | #import <WebCore/HitTestSource.h> |
| 72 | #import <WebCore/ImportNodeOptions.h> |
| 73 | #import <WebCore/JSExecState.h> |
| 74 | #import <WebCore/LocalDOMWindow.h> |
| 75 | #import <WebCore/NativeNodeFilter.h> |
| 76 | #import <WebCore/NodeIterator.h> |
| 77 | #import <WebCore/NodeList.h> |
| 78 | #import <WebCore/ProcessingInstruction.h> |
| 79 | #import <WebCore/Range.h> |
| 80 | #import <WebCore/SecurityOrigin.h> |
| 81 | #import <WebCore/SimpleRange.h> |
| 82 | #import <WebCore/StyleProperties.h> |
| 83 | #import <WebCore/StyleSheetList.h> |
| 84 | #import <WebCore/Text.h> |
| 85 | #import <WebCore/ThreadCheck.h> |
| 86 | #import <WebCore/TreeWalker.h> |
| 87 | #import <WebCore/VisibilityState.h> |
| 88 | #import <WebCore/WebScriptObjectPrivate.h> |
| 89 | #import <WebCore/XPathExpression.h> |
| 90 | #import <WebCore/XPathNSResolver.h> |
| 91 | #import <WebCore/XPathResult.h> |
| 92 | #import <wtf/URL.h> |
| 93 | |
| 94 | #define IMPL static_cast<WebCore::Document*>(reinterpret_cast<WebCore::Node*>(_internal)) |
| 95 | |
| 96 | @implementation DOMDocument |
| 97 | |
| 98 | - (DOMDocumentType *)doctype |
| 99 | { |
| 100 | WebCore::JSMainThreadNullState state; |
| 101 | return kit(WTF::getPtr(IMPL->doctype())); |
| 102 | } |
| 103 | |
| 104 | - (DOMImplementation *)implementation |
| 105 | { |
| 106 | WebCore::JSMainThreadNullState state; |
| 107 | return kit(WTF::getPtr(IMPL->implementation())); |
| 108 | } |
| 109 | |
| 110 | - (DOMElement *)documentElement |
| 111 | { |
| 112 | WebCore::JSMainThreadNullState state; |
| 113 | return kit(WTF::getPtr(IMPL->documentElement())); |
| 114 | } |
| 115 | |
| 116 | - (NSString *)inputEncoding |
| 117 | { |
| 118 | WebCore::JSMainThreadNullState state; |
| 119 | return IMPL->characterSetWithUTF8Fallback().createNSString().autorelease(); |
| 120 | } |
| 121 | |
| 122 | - (NSString *)xmlEncoding |
| 123 | { |
| 124 | WebCore::JSMainThreadNullState state; |
| 125 | return IMPL->xmlEncoding().createNSString().autorelease(); |
| 126 | } |
| 127 | |
| 128 | - (NSString *)xmlVersion |
| 129 | { |
| 130 | WebCore::JSMainThreadNullState state; |
| 131 | return IMPL->xmlVersion().createNSString().autorelease(); |
| 132 | } |
| 133 | |
| 134 | - (void)setXmlVersion:(NSString *)newXmlVersion |
| 135 | { |
| 136 | WebCore::JSMainThreadNullState state; |
| 137 | raiseOnDOMError(IMPL->setXMLVersion(newXmlVersion)); |
| 138 | } |
| 139 | |
| 140 | - (BOOL)xmlStandalone |
| 141 | { |
| 142 | WebCore::JSMainThreadNullState state; |
| 143 | return IMPL->xmlStandalone(); |
| 144 | } |
| 145 | |
| 146 | - (void)setXmlStandalone:(BOOL)newXmlStandalone |
| 147 | { |
| 148 | WebCore::JSMainThreadNullState state; |
| 149 | IMPL->setXMLStandalone(newXmlStandalone); |
| 150 | } |
| 151 | |
| 152 | - (NSString *)documentURI |
| 153 | { |
| 154 | WebCore::JSMainThreadNullState state; |
| 155 | return IMPL->documentURI().createNSString().autorelease(); |
| 156 | } |
| 157 | |
| 158 | - (void)setDocumentURI:(NSString *)newDocumentURI |
| 159 | { |
| 160 | WebCore::JSMainThreadNullState state; |
| 161 | IMPL->setDocumentURI(newDocumentURI); |
| 162 | } |
| 163 | |
| 164 | - (DOMAbstractView *)defaultView |
| 165 | { |
| 166 | WebCore::JSMainThreadNullState state; |
| 167 | return kit(WTF::getPtr(IMPL->windowProxy())); |
Call argument uses a forward declared type 'WebCore::WindowProxy *' | |
| 168 | } |
| 169 | |
| 170 | - (DOMStyleSheetList *)styleSheets |
| 171 | { |
| 172 | WebCore::JSMainThreadNullState state; |
| 173 | return kit(WTF::getPtr(IMPL->styleSheets())); |
| 174 | } |
| 175 | |
| 176 | - (NSString *)contentType |
| 177 | { |
| 178 | WebCore::JSMainThreadNullState state; |
| 179 | return IMPL->contentType().createNSString().autorelease(); |
| 180 | } |
| 181 | |
| 182 | - (NSString *)title |
| 183 | { |
| 184 | WebCore::JSMainThreadNullState state; |
| 185 | return IMPL->title().createNSString().autorelease(); |
| 186 | } |
| 187 | |
| 188 | - (void)setTitle:(NSString *)newTitle |
| 189 | { |
| 190 | WebCore::JSMainThreadNullState state; |
| 191 | IMPL->setTitle(newTitle); |
| 192 | } |
| 193 | |
| 194 | - (NSString *)dir |
| 195 | { |
| 196 | WebCore::JSMainThreadNullState state; |
| 197 | return IMPL->dir().createNSString().autorelease(); |
| 198 | } |
| 199 | |
| 200 | - (void)setDir:(NSString *)newDir |
| 201 | { |
| 202 | WebCore::JSMainThreadNullState state; |
| 203 | IMPL->setDir(newDir); |
| 204 | } |
| 205 | |
| 206 | - (NSString *)referrer |
| 207 | { |
| 208 | WebCore::JSMainThreadNullState state; |
| 209 | return IMPL->referrer().createNSString().autorelease(); |
| 210 | } |
| 211 | |
| 212 | - (NSString *)domain |
| 213 | { |
| 214 | WebCore::JSMainThreadNullState state; |
| 215 | return IMPL->domain().createNSString().autorelease(); |
| 216 | } |
| 217 | |
| 218 | - (NSString *)URL |
| 219 | { |
| 220 | WebCore::JSMainThreadNullState state; |
| 221 | return IMPL->urlForBindings().string().createNSString().autorelease(); |
| 222 | } |
| 223 | |
| 224 | - (NSString *)cookie |
| 225 | { |
| 226 | WebCore::JSMainThreadNullState state; |
| 227 | return raiseOnDOMError(IMPL->cookie()).createNSString().autorelease(); |
| 228 | } |
| 229 | |
| 230 | - (void)setCookie:(NSString *)newCookie |
| 231 | { |
| 232 | WebCore::JSMainThreadNullState state; |
| 233 | raiseOnDOMError(IMPL->setCookie(newCookie)); |
| 234 | } |
| 235 | |
| 236 | - (DOMHTMLElement *)body |
| 237 | { |
| 238 | WebCore::JSMainThreadNullState state; |
| 239 | return kit(WTF::getPtr(IMPL->bodyOrFrameset())); |
| 240 | } |
| 241 | |
| 242 | - (void)setBody:(DOMHTMLElement *)newBody |
| 243 | { |
| 244 | WebCore::JSMainThreadNullState state; |
| 245 | raiseOnDOMError(IMPL->setBodyOrFrameset(core(newBody))); |
| 246 | } |
| 247 | |
| 248 | - (DOMHTMLHeadElement *)head |
| 249 | { |
| 250 | WebCore::JSMainThreadNullState state; |
| 251 | return kit(WTF::getPtr(IMPL->head())); |
| 252 | } |
| 253 | |
| 254 | - (DOMHTMLCollection *)images |
| 255 | { |
| 256 | WebCore::JSMainThreadNullState state; |
| 257 | return kit(WTF::getPtr(IMPL->images())); |
| 258 | } |
| 259 | |
| 260 | - (DOMHTMLCollection *)applets |
| 261 | { |
| 262 | WebCore::JSMainThreadNullState state; |
| 263 | return kit(WTF::getPtr(IMPL->applets())); |
| 264 | } |
| 265 | |
| 266 | - (DOMHTMLCollection *)links |
| 267 | { |
| 268 | WebCore::JSMainThreadNullState state; |
| 269 | return kit(WTF::getPtr(IMPL->links())); |
| 270 | } |
| 271 | |
| 272 | - (DOMHTMLCollection *)forms |
| 273 | { |
| 274 | WebCore::JSMainThreadNullState state; |
| 275 | return kit(WTF::getPtr(IMPL->forms())); |
| 276 | } |
| 277 | |
| 278 | - (DOMHTMLCollection *)anchors |
| 279 | { |
| 280 | WebCore::JSMainThreadNullState state; |
| 281 | return kit(WTF::getPtr(IMPL->anchors())); |
| 282 | } |
| 283 | |
| 284 | - (NSString *)lastModified |
| 285 | { |
| 286 | WebCore::JSMainThreadNullState state; |
| 287 | return IMPL->lastModified().createNSString().autorelease(); |
| 288 | } |
| 289 | |
| 290 | - (NSString *)charset |
| 291 | { |
| 292 | WebCore::JSMainThreadNullState state; |
| 293 | return IMPL->charset().createNSString().autorelease(); |
| 294 | } |
| 295 | |
| 296 | - (void)setCharset:(NSString *)newCharset |
| 297 | { |
| 298 | WebCore::JSMainThreadNullState state; |
| 299 | IMPL->setCharset(newCharset); |
| 300 | } |
| 301 | |
| 302 | - (NSString *)defaultCharset |
| 303 | { |
| 304 | return IMPL->defaultCharsetForLegacyBindings().createNSString().autorelease(); |
| 305 | } |
| 306 | |
| 307 | - (NSString *)readyState |
| 308 | { |
| 309 | WebCore::JSMainThreadNullState state; |
| 310 | auto readyState = IMPL->readyState(); |
| 311 | switch (readyState) { |
| 312 | case WebCore::Document::ReadyState::Loading: |
| 313 | return @"loading"; |
| 314 | case WebCore::Document::ReadyState::Interactive: |
| 315 | return @"interactive"; |
| 316 | case WebCore::Document::ReadyState::Complete: |
| 317 | return @"complete"; |
| 318 | } |
| 319 | ASSERT_NOT_REACHED()((void)0); |
| 320 | return @"complete"; |
| 321 | } |
| 322 | |
| 323 | - (NSString *)characterSet |
| 324 | { |
| 325 | WebCore::JSMainThreadNullState state; |
| 326 | return IMPL->characterSetWithUTF8Fallback().createNSString().autorelease(); |
| 327 | } |
| 328 | |
| 329 | - (NSString *)preferredStylesheetSet |
| 330 | { |
| 331 | return nilnullptr; |
| 332 | } |
| 333 | |
| 334 | - (NSString *)selectedStylesheetSet |
| 335 | { |
| 336 | return nilnullptr; |
| 337 | } |
| 338 | |
| 339 | - (void)setSelectedStylesheetSet:(NSString *)newSelectedStylesheetSet |
| 340 | { |
| 341 | } |
| 342 | |
| 343 | - (DOMElement *)activeElement |
| 344 | { |
| 345 | WebCore::JSMainThreadNullState state; |
| 346 | return kit(WTF::getPtr(IMPL->activeElement())); |
| 347 | } |
| 348 | |
| 349 | - (NSString *)compatMode |
| 350 | { |
| 351 | WebCore::JSMainThreadNullState state; |
| 352 | return IMPL->compatMode().createNSString().autorelease(); |
| 353 | } |
| 354 | |
| 355 | #if ENABLE(FULLSCREEN_API)(defined 1 && 1) |
| 356 | |
| 357 | - (BOOL)webkitIsFullScreen |
| 358 | { |
| 359 | WebCore::JSMainThreadNullState state; |
| 360 | return WebCore::DocumentFullscreen::webkitIsFullScreen(*IMPL); |
| 361 | } |
| 362 | |
| 363 | - (BOOL)webkitFullScreenKeyboardInputAllowed |
| 364 | { |
| 365 | WebCore::JSMainThreadNullState state; |
| 366 | return WebCore::DocumentFullscreen::webkitFullScreenKeyboardInputAllowed(*IMPL); |
| 367 | } |
| 368 | |
| 369 | - (DOMElement *)webkitCurrentFullScreenElement |
| 370 | { |
| 371 | WebCore::JSMainThreadNullState state; |
| 372 | return kit(WTF::getPtr(WebCore::DocumentFullscreen::webkitFullscreenElement(*IMPL))); |
| 373 | } |
| 374 | |
| 375 | - (BOOL)webkitFullscreenEnabled |
| 376 | { |
| 377 | WebCore::JSMainThreadNullState state; |
| 378 | return WebCore::DocumentFullscreen::webkitFullscreenEnabled(*IMPL); |
| 379 | } |
| 380 | |
| 381 | - (DOMElement *)webkitFullscreenElement |
| 382 | { |
| 383 | WebCore::JSMainThreadNullState state; |
| 384 | return kit(WTF::getPtr(WebCore::DocumentFullscreen::webkitFullscreenElement(*IMPL))); |
| 385 | } |
| 386 | |
| 387 | #endif |
| 388 | |
| 389 | - (NSString *)visibilityState |
| 390 | { |
| 391 | WebCore::JSMainThreadNullState state; |
| 392 | switch (IMPL->visibilityState()) { |
| 393 | case WebCore::VisibilityState::Hidden: |
| 394 | return @"hidden"; |
| 395 | case WebCore::VisibilityState::Visible: |
| 396 | return @"visible"; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | - (BOOL)hidden |
| 401 | { |
| 402 | WebCore::JSMainThreadNullState state; |
| 403 | return IMPL->hidden(); |
| 404 | } |
| 405 | |
| 406 | - (DOMHTMLScriptElement *)currentScript |
| 407 | { |
| 408 | WebCore::JSMainThreadNullState state; |
| 409 | WebCore::Element* element = IMPL->currentScript(); |
| 410 | if (!is<WebCore::HTMLScriptElement>(element)) |
| 411 | return nilnullptr; |
| 412 | return kit(WTF::getPtr(downcast<WebCore::HTMLScriptElement>(element))); |
| 413 | } |
| 414 | |
| 415 | - (NSString *)origin |
| 416 | { |
| 417 | WebCore::JSMainThreadNullState state; |
| 418 | return IMPL->securityOrigin().toString().createNSString().autorelease(); |
| 419 | } |
| 420 | |
| 421 | - (DOMElement *)scrollingElement |
| 422 | { |
| 423 | WebCore::JSMainThreadNullState state; |
| 424 | return kit(WTF::getPtr(IMPL->scrollingElementForAPI())); |
| 425 | } |
| 426 | |
| 427 | - (DOMHTMLCollection *)children |
| 428 | { |
| 429 | WebCore::JSMainThreadNullState state; |
| 430 | return kit(WTF::getPtr(IMPL->children())); |
| 431 | } |
| 432 | |
| 433 | - (DOMElement *)firstElementChild |
| 434 | { |
| 435 | WebCore::JSMainThreadNullState state; |
| 436 | return kit(WTF::getPtr(IMPL->firstElementChild())); |
| 437 | } |
| 438 | |
| 439 | - (DOMElement *)lastElementChild |
| 440 | { |
| 441 | WebCore::JSMainThreadNullState state; |
| 442 | return kit(WTF::getPtr(IMPL->lastElementChild())); |
| 443 | } |
| 444 | |
| 445 | - (unsigned)childElementCount |
| 446 | { |
| 447 | WebCore::JSMainThreadNullState state; |
| 448 | return IMPL->childElementCount(); |
| 449 | } |
| 450 | |
| 451 | - (DOMElement *)createElement:(NSString *)tagName |
| 452 | { |
| 453 | WebCore::JSMainThreadNullState state; |
| 454 | return kit(raiseOnDOMError(IMPL->createElementForBindings(tagName)).ptr()); |
| 455 | } |
| 456 | |
| 457 | - (DOMDocumentFragment *)createDocumentFragment |
| 458 | { |
| 459 | WebCore::JSMainThreadNullState state; |
| 460 | return kit(WTF::getPtr(IMPL->createDocumentFragment())); |
| 461 | } |
| 462 | |
| 463 | - (DOMText *)createTextNode:(NSString *)data |
| 464 | { |
| 465 | WebCore::JSMainThreadNullState state; |
| 466 | return kit(WTF::getPtr(IMPL->createTextNode(data))); |
| 467 | } |
| 468 | |
| 469 | - (DOMComment *)createComment:(NSString *)data |
| 470 | { |
| 471 | WebCore::JSMainThreadNullState state; |
| 472 | return kit(WTF::getPtr(IMPL->createComment(data))); |
| 473 | } |
| 474 | |
| 475 | - (DOMCDATASection *)createCDATASection:(NSString *)data |
| 476 | { |
| 477 | WebCore::JSMainThreadNullState state; |
| 478 | return kit(raiseOnDOMError(IMPL->createCDATASection(data)).ptr()); |
| 479 | } |
| 480 | |
| 481 | - (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target data:(NSString *)data |
| 482 | { |
| 483 | WebCore::JSMainThreadNullState state; |
| 484 | return kit(raiseOnDOMError(IMPL->createProcessingInstruction(target, data)).ptr()); |
| 485 | } |
| 486 | |
| 487 | - (DOMAttr *)createAttribute:(NSString *)name |
| 488 | { |
| 489 | WebCore::JSMainThreadNullState state; |
| 490 | return kit(raiseOnDOMError(IMPL->createAttribute(name)).ptr()); |
| 491 | } |
| 492 | |
| 493 | - (DOMEntityReference *)createEntityReference:(NSString *)name |
| 494 | { |
| 495 | UNUSED_PARAM(name)(void)name; |
| 496 | raiseNotSupportedErrorException(); |
| 497 | } |
| 498 | |
| 499 | - (DOMNodeList *)getElementsByTagName:(NSString *)tagname |
| 500 | { |
| 501 | if (!tagname) |
| 502 | return nullptr; |
| 503 | |
| 504 | WebCore::JSMainThreadNullState state; |
| 505 | return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagName(tagname)))); |
| 506 | } |
| 507 | |
| 508 | - (DOMNode *)importNode:(DOMNode *)importedNode deep:(BOOL)deep |
| 509 | { |
| 510 | WebCore::JSMainThreadNullState state; |
| 511 | if (!importedNode) |
| 512 | raiseTypeErrorException(); |
| 513 | return kit(raiseOnDOMError(IMPL->importNode(*core(importedNode), static_cast<bool>(deep))).ptr()); |
| 514 | } |
| 515 | |
| 516 | - (DOMElement *)createElementNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName |
| 517 | { |
| 518 | WebCore::JSMainThreadNullState state; |
| 519 | return kit(raiseOnDOMError(IMPL->createElementNS(namespaceURI, qualifiedName)).ptr()); |
| 520 | } |
| 521 | |
| 522 | - (DOMAttr *)createAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName |
| 523 | { |
| 524 | WebCore::JSMainThreadNullState state; |
| 525 | return kit(raiseOnDOMError(IMPL->createAttributeNS(namespaceURI, qualifiedName)).ptr()); |
| 526 | } |
| 527 | |
| 528 | - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName |
| 529 | { |
| 530 | if (!localName) |
| 531 | return nullptr; |
| 532 | WebCore::JSMainThreadNullState state; |
| 533 | return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByTagNameNS(namespaceURI, localName)))); |
| 534 | } |
| 535 | |
| 536 | - (DOMNode *)adoptNode:(DOMNode *)source |
| 537 | { |
| 538 | WebCore::JSMainThreadNullState state; |
| 539 | if (!source) |
| 540 | raiseTypeErrorException(); |
| 541 | return kit(raiseOnDOMError(IMPL->adoptNode(*core(source))).ptr()); |
| 542 | } |
| 543 | |
| 544 | - (DOMEvent *)createEvent:(NSString *)eventType |
| 545 | { |
| 546 | WebCore::JSMainThreadNullState state; |
| 547 | return kit(raiseOnDOMError(IMPL->createEvent(eventType)).ptr()); |
| 548 | } |
| 549 | |
| 550 | - (DOMRange *)createRange |
| 551 | { |
| 552 | WebCore::JSMainThreadNullState state; |
| 553 | return kit(WTF::getPtr(IMPL->createRange())); |
| 554 | } |
| 555 | |
| 556 | - (DOMNodeIterator *)createNodeIterator:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences |
| 557 | { |
| 558 | WebCore::JSMainThreadNullState state; |
| 559 | if (!root) |
| 560 | raiseTypeErrorException(); |
| 561 | RefPtr<WebCore::NodeFilter> nativeNodeFilter; |
| 562 | if (filter) |
| 563 | nativeNodeFilter = WebCore::NativeNodeFilter::create(IMPL, WebCore::ObjCNodeFilterCondition::create(filter)); |
| 564 | return kit(WTF::getPtr(IMPL->createNodeIterator(*core(root), whatToShow, WTF::getPtr(nativeNodeFilter), expandEntityReferences))); |
| 565 | } |
| 566 | |
| 567 | - (DOMTreeWalker *)createTreeWalker:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences |
| 568 | { |
| 569 | WebCore::JSMainThreadNullState state; |
| 570 | if (!root) |
| 571 | raiseTypeErrorException(); |
| 572 | RefPtr<WebCore::NodeFilter> nativeNodeFilter; |
| 573 | if (filter) |
| 574 | nativeNodeFilter = WebCore::NativeNodeFilter::create(IMPL, WebCore::ObjCNodeFilterCondition::create(filter)); |
| 575 | return kit(WTF::getPtr(IMPL->createTreeWalker(*core(root), whatToShow, WTF::getPtr(nativeNodeFilter), expandEntityReferences))); |
| 576 | } |
| 577 | |
| 578 | - (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement |
| 579 | { |
| 580 | return nilnullptr; |
| 581 | } |
| 582 | |
| 583 | static RefPtr<WebCore::XPathNSResolver> wrap(id <DOMXPathNSResolver> resolver) |
| 584 | { |
| 585 | if (!resolver) |
| 586 | return nullptr; |
| 587 | if ([resolver isMemberOfClass:[DOMNativeXPathNSResolver class]]) |
| 588 | return core(static_cast<DOMNativeXPathNSResolver *>(resolver)); |
| 589 | return DOMCustomXPathNSResolver::create(resolver); |
| 590 | } |
| 591 | |
| 592 | - (DOMXPathExpression *)createExpression:(NSString *)expression resolver:(id <DOMXPathNSResolver>)resolver |
| 593 | { |
| 594 | WebCore::JSMainThreadNullState state; |
| 595 | return kit(raiseOnDOMError(IMPL->createExpression(expression, wrap(resolver))).ptr()); |
| 596 | } |
| 597 | |
| 598 | - (id <DOMXPathNSResolver>)createNSResolver:(DOMNode *)nodeResolver |
| 599 | { |
| 600 | WebCore::JSMainThreadNullState state; |
| 601 | if (!nodeResolver) |
| 602 | return nullptr; |
| 603 | |
| 604 | return kit(WTF::getPtr(IMPL->createNSResolver(*core(nodeResolver)))); |
| 605 | } |
| 606 | |
| 607 | - (DOMXPathResult *)evaluate:(NSString *)expression contextNode:(DOMNode *)contextNode resolver:(id <DOMXPathNSResolver>)resolver type:(unsigned short)type inResult:(DOMXPathResult *)inResult |
| 608 | { |
| 609 | if (!contextNode) |
| 610 | return nullptr; |
| 611 | |
| 612 | WebCore::JSMainThreadNullState state; |
| 613 | return kit(raiseOnDOMError(IMPL->evaluate(expression, *core(contextNode), wrap(resolver), type, core(inResult))).ptr()); |
| 614 | } |
| 615 | |
| 616 | - (BOOL)execCommand:(NSString *)command userInterface:(BOOL)userInterface value:(NSString *)value |
| 617 | { |
| 618 | WebCore::JSMainThreadNullState state; |
| 619 | auto result = IMPL->execCommand(command, userInterface, value); |
| 620 | return result.hasException() ? NO__objc_no : result.returnValue(); |
| 621 | } |
| 622 | |
| 623 | - (BOOL)execCommand:(NSString *)command userInterface:(BOOL)userInterface |
| 624 | { |
| 625 | return [self execCommand:command userInterface:userInterface value:nullptr]; |
| 626 | } |
| 627 | |
| 628 | - (BOOL)execCommand:(NSString *)command |
| 629 | { |
| 630 | return [self execCommand:command userInterface:NO__objc_no value:nullptr]; |
| 631 | } |
| 632 | |
| 633 | - (BOOL)queryCommandEnabled:(NSString *)command |
| 634 | { |
| 635 | WebCore::JSMainThreadNullState state; |
| 636 | auto result = IMPL->queryCommandEnabled(command); |
| 637 | return result.hasException() ? NO__objc_no : result.returnValue(); |
| 638 | } |
| 639 | |
| 640 | - (BOOL)queryCommandIndeterm:(NSString *)command |
| 641 | { |
| 642 | WebCore::JSMainThreadNullState state; |
| 643 | auto result = IMPL->queryCommandIndeterm(command); |
| 644 | return result.hasException() ? NO__objc_no : result.returnValue(); |
| 645 | } |
| 646 | |
| 647 | - (BOOL)queryCommandState:(NSString *)command |
| 648 | { |
| 649 | WebCore::JSMainThreadNullState state; |
| 650 | auto result = IMPL->queryCommandState(command); |
| 651 | return result.hasException() ? NO__objc_no : result.returnValue(); |
| 652 | } |
| 653 | |
| 654 | - (BOOL)queryCommandSupported:(NSString *)command |
| 655 | { |
| 656 | WebCore::JSMainThreadNullState state; |
| 657 | auto result = IMPL->queryCommandSupported(command); |
| 658 | return result.hasException() ? NO__objc_no : result.returnValue(); |
| 659 | } |
| 660 | |
| 661 | - (NSString *)queryCommandValue:(NSString *)command |
| 662 | { |
| 663 | WebCore::JSMainThreadNullState state; |
| 664 | auto result = IMPL->queryCommandValue(command); |
| 665 | return result.hasException() ? @"" : result.returnValue().createNSString().autorelease(); |
| 666 | } |
| 667 | |
| 668 | - (DOMNodeList *)getElementsByName:(NSString *)elementName |
| 669 | { |
| 670 | WebCore::JSMainThreadNullState state; |
| 671 | return kit(WTF::getPtr(IMPL->getElementsByName(elementName))); |
| 672 | } |
| 673 | |
| 674 | - (DOMElement *)elementFromPoint:(int)x y:(int)y |
| 675 | { |
| 676 | WebCore::JSMainThreadNullState state; |
| 677 | return kit(WTF::getPtr(IMPL->elementFromPoint(x, y, WebCore::HitTestSource::User))); |
| 678 | } |
| 679 | |
| 680 | - (DOMRange *)caretRangeFromPoint:(int)x y:(int)y |
| 681 | { |
| 682 | WebCore::JSMainThreadNullState state; |
| 683 | return kit(WTF::getPtr(IMPL->caretRangeFromPoint(x, y, WebCore::HitTestSource::User))); |
| 684 | } |
| 685 | |
| 686 | - (DOMCSSStyleDeclaration *)createCSSStyleDeclaration |
| 687 | { |
| 688 | WebCore::JSMainThreadNullState state; |
| 689 | return kit(WTF::getPtr(IMPL->createCSSStyleDeclaration())); |
| 690 | } |
| 691 | |
| 692 | - (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement |
| 693 | { |
| 694 | WebCore::JSMainThreadNullState state; |
| 695 | if (!element) |
| 696 | raiseTypeErrorException(); |
| 697 | auto* dv = IMPL->window(); |
| 698 | if (!dv) |
| 699 | return nilnullptr; |
| 700 | return kit(WTF::getPtr(dv->getComputedStyle(*core(element), pseudoElement))); |
| 701 | } |
| 702 | |
| 703 | - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement |
| 704 | { |
| 705 | return [self getMatchedCSSRules:element pseudoElement:pseudoElement authorOnly:YES__objc_yes]; |
| 706 | } |
| 707 | |
| 708 | - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement authorOnly:(BOOL)authorOnly |
| 709 | { |
| 710 | WebCore::JSMainThreadNullState state; |
| 711 | auto* dv = IMPL->window(); |
| 712 | if (!dv) |
| 713 | return nilnullptr; |
| 714 | return kit(WTF::getPtr(dv->getMatchedCSSRules(core(element), pseudoElement, authorOnly))); |
| 715 | } |
| 716 | |
| 717 | - (DOMNodeList *)getElementsByClassName:(NSString *)classNames |
| 718 | { |
| 719 | WebCore::JSMainThreadNullState state; |
| 720 | return kit(static_cast<WebCore::NodeList*>(WTF::getPtr(IMPL->getElementsByClassName(classNames)))); |
| 721 | } |
| 722 | |
| 723 | - (BOOL)hasFocus |
| 724 | { |
| 725 | WebCore::JSMainThreadNullState state; |
| 726 | return IMPL->hasFocus(); |
| 727 | } |
| 728 | |
| 729 | #if ENABLE(FULLSCREEN_API)(defined 1 && 1) |
| 730 | |
| 731 | - (void)webkitCancelFullScreen |
| 732 | { |
| 733 | WebCore::JSMainThreadNullState state; |
| 734 | WebCore::DocumentFullscreen::webkitCancelFullScreen(*IMPL); |
| 735 | } |
| 736 | |
| 737 | - (void)webkitExitFullscreen |
| 738 | { |
| 739 | WebCore::JSMainThreadNullState state; |
| 740 | WebCore::DocumentFullscreen::webkitExitFullscreen(*IMPL); |
| 741 | } |
| 742 | |
| 743 | #endif |
| 744 | |
| 745 | - (DOMElement *)getElementById:(NSString *)elementId |
| 746 | { |
| 747 | WebCore::JSMainThreadNullState state; |
| 748 | return kit(WTF::getPtr(IMPL->getElementById(AtomString(elementId)))); |
| 749 | } |
| 750 | |
| 751 | - (DOMElement *)querySelector:(NSString *)selectors |
| 752 | { |
| 753 | WebCore::JSMainThreadNullState state; |
| 754 | return kit(raiseOnDOMError(IMPL->querySelector(selectors))); |
| 755 | } |
| 756 | |
| 757 | - (DOMNodeList *)querySelectorAll:(NSString *)selectors |
| 758 | { |
| 759 | WebCore::JSMainThreadNullState state; |
| 760 | return kit(raiseOnDOMError(IMPL->querySelectorAll(selectors)).ptr()); |
| 761 | } |
| 762 | |
| 763 | @end |
| 764 | |
| 765 | @implementation DOMDocument (DOMDocumentDeprecated) |
| 766 | |
| 767 | - (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data |
| 768 | { |
| 769 | return [self createProcessingInstruction:target data:data]; |
| 770 | } |
| 771 | |
| 772 | - (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep |
| 773 | { |
| 774 | return [self importNode:importedNode deep:deep]; |
| 775 | } |
| 776 | |
| 777 | - (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName |
| 778 | { |
| 779 | return [self createElementNS:namespaceURI qualifiedName:qualifiedName]; |
| 780 | } |
| 781 | |
| 782 | - (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName |
| 783 | { |
| 784 | return [self createAttributeNS:namespaceURI qualifiedName:qualifiedName]; |
| 785 | } |
| 786 | |
| 787 | - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName |
| 788 | { |
| 789 | return [self getElementsByTagNameNS:namespaceURI localName:localName]; |
| 790 | } |
| 791 | |
| 792 | - (DOMNodeIterator *)createNodeIterator:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences |
| 793 | { |
| 794 | return [self createNodeIterator:root whatToShow:whatToShow filter:filter expandEntityReferences:expandEntityReferences]; |
| 795 | } |
| 796 | |
| 797 | - (DOMTreeWalker *)createTreeWalker:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences |
| 798 | { |
| 799 | return [self createTreeWalker:root whatToShow:whatToShow filter:filter expandEntityReferences:expandEntityReferences]; |
| 800 | } |
| 801 | |
| 802 | - (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element :(NSString *)pseudoElement |
| 803 | { |
| 804 | return nilnullptr; |
| 805 | } |
| 806 | |
| 807 | - (DOMXPathExpression *)createExpression:(NSString *)expression :(id <DOMXPathNSResolver>)resolver |
| 808 | { |
| 809 | return [self createExpression:expression resolver:resolver]; |
| 810 | } |
| 811 | |
| 812 | - (DOMXPathResult *)evaluate:(NSString *)expression :(DOMNode *)contextNode :(id <DOMXPathNSResolver>)resolver :(unsigned short)type :(DOMXPathResult *)inResult |
| 813 | { |
| 814 | return [self evaluate:expression contextNode:contextNode resolver:resolver type:type inResult:inResult]; |
| 815 | } |
| 816 | |
| 817 | - (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element :(NSString *)pseudoElement |
| 818 | { |
| 819 | return [self getComputedStyle:element pseudoElement:pseudoElement]; |
| 820 | } |
| 821 | |
| 822 | @end |
| 823 | |
| 824 | WebCore::Document* core(DOMDocument *wrapper) |
| 825 | { |
| 826 | return wrapper ? reinterpret_cast<WebCore::Document*>(wrapper->_internal) : 0; |
| 827 | } |
| 828 | |
| 829 | DOMDocument *kit(WebCore::Document* value) |
| 830 | { |
| 831 | WebCoreThreadViolationCheckRoundOne()::WebCore::reportThreadViolation(__PRETTY_FUNCTION__, WebCore ::ThreadViolationRoundOne); |
| 832 | return static_cast<DOMDocument*>(kit(static_cast<WebCore::Node*>(value))); |
| 833 | } |
| 834 | |
| 835 | #undef IMPL |