OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 void Internals::crash() | 258 void Internals::crash() |
259 { | 259 { |
260 CRASH(); | 260 CRASH(); |
261 } | 261 } |
262 | 262 |
263 PassRefPtr<Element> Internals::createContentElement(ExceptionCode& ec) | 263 PassRefPtr<Element> Internals::createContentElement(ExceptionCode& ec) |
264 { | 264 { |
265 Document* document = contextDocument(); | 265 Document* document = contextDocument(); |
266 if (!document) { | 266 if (!document) { |
267 ec = INVALID_ACCESS_ERR; | 267 ec = InvalidAccessError; |
268 return 0; | 268 return 0; |
269 } | 269 } |
270 | 270 |
271 return HTMLContentElement::create(document); | 271 return HTMLContentElement::create(document); |
272 } | 272 } |
273 | 273 |
274 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionCode& ec) | 274 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionCode& ec) |
275 { | 275 { |
276 if (!insertionPoint || !insertionPoint->isInsertionPoint()) { | 276 if (!insertionPoint || !insertionPoint->isInsertionPoint()) { |
277 ec = INVALID_ACCESS_ERR; | 277 ec = InvalidAccessError; |
278 return false; | 278 return false; |
279 } | 279 } |
280 | 280 |
281 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio
nPoint)->isSelectValid(); | 281 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio
nPoint)->isSelectValid(); |
282 } | 282 } |
283 | 283 |
284 Node* Internals::treeScopeRootNode(Node* node, ExceptionCode& ec) | 284 Node* Internals::treeScopeRootNode(Node* node, ExceptionCode& ec) |
285 { | 285 { |
286 if (!node) { | 286 if (!node) { |
287 ec = INVALID_ACCESS_ERR; | 287 ec = InvalidAccessError; |
288 return 0; | 288 return 0; |
289 } | 289 } |
290 | 290 |
291 return node->treeScope()->rootNode(); | 291 return node->treeScope()->rootNode(); |
292 } | 292 } |
293 | 293 |
294 Node* Internals::parentTreeScope(Node* node, ExceptionCode& ec) | 294 Node* Internals::parentTreeScope(Node* node, ExceptionCode& ec) |
295 { | 295 { |
296 if (!node) { | 296 if (!node) { |
297 ec = INVALID_ACCESS_ERR; | 297 ec = InvalidAccessError; |
298 return 0; | 298 return 0; |
299 } | 299 } |
300 const TreeScope* parentTreeScope = node->treeScope()->parentTreeScope(); | 300 const TreeScope* parentTreeScope = node->treeScope()->parentTreeScope(); |
301 return parentTreeScope ? parentTreeScope->rootNode() : 0; | 301 return parentTreeScope ? parentTreeScope->rootNode() : 0; |
302 } | 302 } |
303 | 303 |
304 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E
xceptionCode& ec) | 304 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E
xceptionCode& ec) |
305 { | 305 { |
306 if (!host || !host->shadow()) { | 306 if (!host || !host->shadow()) { |
307 ec = INVALID_ACCESS_ERR; | 307 ec = InvalidAccessError; |
308 return 0; | 308 return 0; |
309 } | 309 } |
310 | 310 |
311 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForId(idValue); | 311 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForId(idValue); |
312 } | 312 } |
313 | 313 |
314 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa
me, ExceptionCode& ec) | 314 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa
me, ExceptionCode& ec) |
315 { | 315 { |
316 if (!host || !host->shadow()) { | 316 if (!host || !host->shadow()) { |
317 ec = INVALID_ACCESS_ERR; | 317 ec = InvalidAccessError; |
318 return 0; | 318 return 0; |
319 } | 319 } |
320 | 320 |
321 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForClass(className); | 321 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForClass(className); |
322 } | 322 } |
323 | 323 |
324 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att
ributeName, ExceptionCode& ec) | 324 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att
ributeName, ExceptionCode& ec) |
325 { | 325 { |
326 if (!host || !host->shadow()) { | 326 if (!host || !host->shadow()) { |
327 ec = INVALID_ACCESS_ERR; | 327 ec = InvalidAccessError; |
328 return 0; | 328 return 0; |
329 } | 329 } |
330 | 330 |
331 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForAttribute(attributeName); | 331 return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).
hasSelectorForAttribute(attributeName); |
332 } | 332 } |
333 | 333 |
334 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p
seudoClass, ExceptionCode& ec) | 334 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p
seudoClass, ExceptionCode& ec) |
335 { | 335 { |
336 if (!host || !host->shadow()) { | 336 if (!host || !host->shadow()) { |
337 ec = INVALID_ACCESS_ERR; | 337 ec = InvalidAccessError; |
338 return 0; | 338 return 0; |
339 } | 339 } |
340 | 340 |
341 const SelectRuleFeatureSet& featureSet = host->shadow()->distributor().ensur
eSelectFeatureSet(host->shadow()); | 341 const SelectRuleFeatureSet& featureSet = host->shadow()->distributor().ensur
eSelectFeatureSet(host->shadow()); |
342 if (pseudoClass == "checked") | 342 if (pseudoClass == "checked") |
343 return featureSet.hasSelectorForChecked(); | 343 return featureSet.hasSelectorForChecked(); |
344 if (pseudoClass == "enabled") | 344 if (pseudoClass == "enabled") |
345 return featureSet.hasSelectorForEnabled(); | 345 return featureSet.hasSelectorForEnabled(); |
346 if (pseudoClass == "disabled") | 346 if (pseudoClass == "disabled") |
347 return featureSet.hasSelectorForDisabled(); | 347 return featureSet.hasSelectorForDisabled(); |
348 if (pseudoClass == "indeterminate") | 348 if (pseudoClass == "indeterminate") |
349 return featureSet.hasSelectorForIndeterminate(); | 349 return featureSet.hasSelectorForIndeterminate(); |
350 if (pseudoClass == "link") | 350 if (pseudoClass == "link") |
351 return featureSet.hasSelectorForLink(); | 351 return featureSet.hasSelectorForLink(); |
352 if (pseudoClass == "target") | 352 if (pseudoClass == "target") |
353 return featureSet.hasSelectorForTarget(); | 353 return featureSet.hasSelectorForTarget(); |
354 if (pseudoClass == "visited") | 354 if (pseudoClass == "visited") |
355 return featureSet.hasSelectorForVisited(); | 355 return featureSet.hasSelectorForVisited(); |
356 | 356 |
357 ASSERT_NOT_REACHED(); | 357 ASSERT_NOT_REACHED(); |
358 return false; | 358 return false; |
359 } | 359 } |
360 | 360 |
361 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node
* node2, ExceptionCode& ec) const | 361 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node
* node2, ExceptionCode& ec) const |
362 { | 362 { |
363 if (!node1 || !node2) { | 363 if (!node1 || !node2) { |
364 ec = INVALID_ACCESS_ERR; | 364 ec = InvalidAccessError; |
365 return 0; | 365 return 0; |
366 } | 366 } |
367 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node1)) : | 367 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node1)) : |
368 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1
)) : 0; | 368 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1
)) : 0; |
369 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node2)) : | 369 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node2)) : |
370 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2
)) : 0; | 370 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2
)) : 0; |
371 if (!treeScope1 || !treeScope2) { | 371 if (!treeScope1 || !treeScope2) { |
372 ec = INVALID_ACCESS_ERR; | 372 ec = InvalidAccessError; |
373 return 0; | 373 return 0; |
374 } | 374 } |
375 return treeScope1->comparePosition(treeScope2); | 375 return treeScope1->comparePosition(treeScope2); |
376 } | 376 } |
377 | 377 |
378 unsigned Internals::numberOfActiveAnimations() const | 378 unsigned Internals::numberOfActiveAnimations() const |
379 { | 379 { |
380 Frame* contextFrame = frame(); | 380 Frame* contextFrame = frame(); |
381 if (AnimationController* controller = contextFrame->animation()) | 381 if (AnimationController* controller = contextFrame->animation()) |
382 return controller->numberOfActiveAnimations(contextFrame->document()); | 382 return controller->numberOfActiveAnimations(contextFrame->document()); |
383 return 0; | 383 return 0; |
384 } | 384 } |
385 | 385 |
386 void Internals::suspendAnimations(Document* document, ExceptionCode& ec) const | 386 void Internals::suspendAnimations(Document* document, ExceptionCode& ec) const |
387 { | 387 { |
388 if (!document || !document->frame()) { | 388 if (!document || !document->frame()) { |
389 ec = INVALID_ACCESS_ERR; | 389 ec = InvalidAccessError; |
390 return; | 390 return; |
391 } | 391 } |
392 | 392 |
393 AnimationController* controller = document->frame()->animation(); | 393 AnimationController* controller = document->frame()->animation(); |
394 if (!controller) | 394 if (!controller) |
395 return; | 395 return; |
396 | 396 |
397 controller->suspendAnimations(); | 397 controller->suspendAnimations(); |
398 } | 398 } |
399 | 399 |
400 void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const | 400 void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const |
401 { | 401 { |
402 if (!document || !document->frame()) { | 402 if (!document || !document->frame()) { |
403 ec = INVALID_ACCESS_ERR; | 403 ec = InvalidAccessError; |
404 return; | 404 return; |
405 } | 405 } |
406 | 406 |
407 AnimationController* controller = document->frame()->animation(); | 407 AnimationController* controller = document->frame()->animation(); |
408 if (!controller) | 408 if (!controller) |
409 return; | 409 return; |
410 | 410 |
411 controller->resumeAnimations(); | 411 controller->resumeAnimations(); |
412 } | 412 } |
413 | 413 |
414 void Internals::pauseAnimations(double pauseTime, ExceptionCode& ec) | 414 void Internals::pauseAnimations(double pauseTime, ExceptionCode& ec) |
415 { | 415 { |
416 if (pauseTime < 0) { | 416 if (pauseTime < 0) { |
417 ec = INVALID_ACCESS_ERR; | 417 ec = InvalidAccessError; |
418 return; | 418 return; |
419 } | 419 } |
420 | 420 |
421 frame()->animation()->pauseAnimationsForTesting(pauseTime); | 421 frame()->animation()->pauseAnimationsForTesting(pauseTime); |
422 } | 422 } |
423 | 423 |
424 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) con
st | 424 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) con
st |
425 { | 425 { |
426 if (root && root->isShadowRoot()) | 426 if (root && root->isShadowRoot()) |
427 return ScopeContentDistribution::hasShadowElement(toShadowRoot(root)); | 427 return ScopeContentDistribution::hasShadowElement(toShadowRoot(root)); |
428 | 428 |
429 ec = INVALID_ACCESS_ERR; | 429 ec = InvalidAccessError; |
430 return 0; | 430 return 0; |
431 } | 431 } |
432 | 432 |
433 bool Internals::hasContentElement(const Node* root, ExceptionCode& ec) const | 433 bool Internals::hasContentElement(const Node* root, ExceptionCode& ec) const |
434 { | 434 { |
435 if (root && root->isShadowRoot()) | 435 if (root && root->isShadowRoot()) |
436 return ScopeContentDistribution::hasContentElement(toShadowRoot(root)); | 436 return ScopeContentDistribution::hasContentElement(toShadowRoot(root)); |
437 | 437 |
438 ec = INVALID_ACCESS_ERR; | 438 ec = InvalidAccessError; |
439 return 0; | 439 return 0; |
440 } | 440 } |
441 | 441 |
442 size_t Internals::countElementShadow(const Node* root, ExceptionCode& ec) const | 442 size_t Internals::countElementShadow(const Node* root, ExceptionCode& ec) const |
443 { | 443 { |
444 if (!root || !root->isShadowRoot()) { | 444 if (!root || !root->isShadowRoot()) { |
445 ec = INVALID_ACCESS_ERR; | 445 ec = InvalidAccessError; |
446 return 0; | 446 return 0; |
447 } | 447 } |
448 | 448 |
449 return ScopeContentDistribution::countElementShadow(toShadowRoot(root)); | 449 return ScopeContentDistribution::countElementShadow(toShadowRoot(root)); |
450 } | 450 } |
451 | 451 |
452 bool Internals::attached(Node* node, ExceptionCode& ec) | 452 bool Internals::attached(Node* node, ExceptionCode& ec) |
453 { | 453 { |
454 if (!node) { | 454 if (!node) { |
455 ec = INVALID_ACCESS_ERR; | 455 ec = InvalidAccessError; |
456 return false; | 456 return false; |
457 } | 457 } |
458 | 458 |
459 return node->attached(); | 459 return node->attached(); |
460 } | 460 } |
461 | 461 |
462 Node* Internals::nextSiblingByWalker(Node* node, ExceptionCode& ec) | 462 Node* Internals::nextSiblingByWalker(Node* node, ExceptionCode& ec) |
463 { | 463 { |
464 if (!node) { | 464 if (!node) { |
465 ec = INVALID_ACCESS_ERR; | 465 ec = InvalidAccessError; |
466 return 0; | 466 return 0; |
467 } | 467 } |
468 ComposedShadowTreeWalker walker(node); | 468 ComposedShadowTreeWalker walker(node); |
469 walker.nextSibling(); | 469 walker.nextSibling(); |
470 return walker.get(); | 470 return walker.get(); |
471 } | 471 } |
472 | 472 |
473 Node* Internals::firstChildByWalker(Node* node, ExceptionCode& ec) | 473 Node* Internals::firstChildByWalker(Node* node, ExceptionCode& ec) |
474 { | 474 { |
475 if (!node) { | 475 if (!node) { |
476 ec = INVALID_ACCESS_ERR; | 476 ec = InvalidAccessError; |
477 return 0; | 477 return 0; |
478 } | 478 } |
479 ComposedShadowTreeWalker walker(node); | 479 ComposedShadowTreeWalker walker(node); |
480 walker.firstChild(); | 480 walker.firstChild(); |
481 return walker.get(); | 481 return walker.get(); |
482 } | 482 } |
483 | 483 |
484 Node* Internals::lastChildByWalker(Node* node, ExceptionCode& ec) | 484 Node* Internals::lastChildByWalker(Node* node, ExceptionCode& ec) |
485 { | 485 { |
486 if (!node) { | 486 if (!node) { |
487 ec = INVALID_ACCESS_ERR; | 487 ec = InvalidAccessError; |
488 return 0; | 488 return 0; |
489 } | 489 } |
490 ComposedShadowTreeWalker walker(node); | 490 ComposedShadowTreeWalker walker(node); |
491 walker.lastChild(); | 491 walker.lastChild(); |
492 return walker.get(); | 492 return walker.get(); |
493 } | 493 } |
494 | 494 |
495 Node* Internals::nextNodeByWalker(Node* node, ExceptionCode& ec) | 495 Node* Internals::nextNodeByWalker(Node* node, ExceptionCode& ec) |
496 { | 496 { |
497 if (!node) { | 497 if (!node) { |
498 ec = INVALID_ACCESS_ERR; | 498 ec = InvalidAccessError; |
499 return 0; | 499 return 0; |
500 } | 500 } |
501 ComposedShadowTreeWalker walker(node); | 501 ComposedShadowTreeWalker walker(node); |
502 walker.next(); | 502 walker.next(); |
503 return walker.get(); | 503 return walker.get(); |
504 } | 504 } |
505 | 505 |
506 Node* Internals::previousNodeByWalker(Node* node, ExceptionCode& ec) | 506 Node* Internals::previousNodeByWalker(Node* node, ExceptionCode& ec) |
507 { | 507 { |
508 if (!node) { | 508 if (!node) { |
509 ec = INVALID_ACCESS_ERR; | 509 ec = InvalidAccessError; |
510 return 0; | 510 return 0; |
511 } | 511 } |
512 ComposedShadowTreeWalker walker(node); | 512 ComposedShadowTreeWalker walker(node); |
513 walker.previous(); | 513 walker.previous(); |
514 return walker.get(); | 514 return walker.get(); |
515 } | 515 } |
516 | 516 |
517 String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec) | 517 String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec) |
518 { | 518 { |
519 if (!element) { | 519 if (!element) { |
520 ec = INVALID_ACCESS_ERR; | 520 ec = InvalidAccessError; |
521 return String(); | 521 return String(); |
522 } | 522 } |
523 | 523 |
524 String representation = externalRepresentation(element); | 524 String representation = externalRepresentation(element); |
525 if (representation.isEmpty()) { | 525 if (representation.isEmpty()) { |
526 ec = INVALID_ACCESS_ERR; | 526 ec = InvalidAccessError; |
527 return String(); | 527 return String(); |
528 } | 528 } |
529 | 529 |
530 return representation; | 530 return representation; |
531 } | 531 } |
532 | 532 |
533 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionCo
de& ec) const | 533 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionCo
de& ec) const |
534 { | 534 { |
535 if (scope && (scope->isElementNode() || scope->isShadowRoot())) | 535 if (scope && (scope->isElementNode() || scope->isShadowRoot())) |
536 return scope->numberOfScopedHTMLStyleChildren(); | 536 return scope->numberOfScopedHTMLStyleChildren(); |
537 | 537 |
538 ec = INVALID_ACCESS_ERR; | 538 ec = InvalidAccessError; |
539 return 0; | 539 return 0; |
540 } | 540 } |
541 | 541 |
542 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited
Info(Node* node, ExceptionCode& ec) const | 542 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited
Info(Node* node, ExceptionCode& ec) const |
543 { | 543 { |
544 if (!node) { | 544 if (!node) { |
545 ec = INVALID_ACCESS_ERR; | 545 ec = InvalidAccessError; |
546 return 0; | 546 return 0; |
547 } | 547 } |
548 | 548 |
549 bool allowVisitedStyle = true; | 549 bool allowVisitedStyle = true; |
550 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); | 550 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); |
551 } | 551 } |
552 | 552 |
553 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionCode& ec) | 553 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionCode& ec) |
554 { | 554 { |
555 if (!host) { | 555 if (!host) { |
556 ec = INVALID_ACCESS_ERR; | 556 ec = InvalidAccessError; |
557 return 0; | 557 return 0; |
558 } | 558 } |
559 | 559 |
560 if (ElementShadow* shadow = host->shadow()) | 560 if (ElementShadow* shadow = host->shadow()) |
561 return shadow->youngestShadowRoot(); | 561 return shadow->youngestShadowRoot(); |
562 | 562 |
563 return host->createShadowRoot(ec).get(); | 563 return host->createShadowRoot(ec).get(); |
564 } | 564 } |
565 | 565 |
566 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionCode& ec) | 566 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionCode& ec) |
567 { | 567 { |
568 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). | 568 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). |
569 // https://bugs.webkit.org/show_bug.cgi?id=78465 | 569 // https://bugs.webkit.org/show_bug.cgi?id=78465 |
570 return youngestShadowRoot(host, ec); | 570 return youngestShadowRoot(host, ec); |
571 } | 571 } |
572 | 572 |
573 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionCode& ec) | 573 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionCode& ec) |
574 { | 574 { |
575 if (!host) { | 575 if (!host) { |
576 ec = INVALID_ACCESS_ERR; | 576 ec = InvalidAccessError; |
577 return 0; | 577 return 0; |
578 } | 578 } |
579 | 579 |
580 if (ElementShadow* shadow = host->shadow()) | 580 if (ElementShadow* shadow = host->shadow()) |
581 return shadow->youngestShadowRoot(); | 581 return shadow->youngestShadowRoot(); |
582 return 0; | 582 return 0; |
583 } | 583 } |
584 | 584 |
585 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionCode& ec) | 585 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionCode& ec) |
586 { | 586 { |
587 if (!host) { | 587 if (!host) { |
588 ec = INVALID_ACCESS_ERR; | 588 ec = InvalidAccessError; |
589 return 0; | 589 return 0; |
590 } | 590 } |
591 | 591 |
592 if (ElementShadow* shadow = host->shadow()) | 592 if (ElementShadow* shadow = host->shadow()) |
593 return shadow->oldestShadowRoot(); | 593 return shadow->oldestShadowRoot(); |
594 return 0; | 594 return 0; |
595 } | 595 } |
596 | 596 |
597 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionCode& ec) | 597 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionCode& ec) |
598 { | 598 { |
599 if (!shadow || !shadow->isShadowRoot()) { | 599 if (!shadow || !shadow->isShadowRoot()) { |
600 ec = INVALID_ACCESS_ERR; | 600 ec = InvalidAccessError; |
601 return 0; | 601 return 0; |
602 } | 602 } |
603 | 603 |
604 return toShadowRoot(shadow)->youngerShadowRoot(); | 604 return toShadowRoot(shadow)->youngerShadowRoot(); |
605 } | 605 } |
606 | 606 |
607 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionCode& ec) | 607 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionCode& ec) |
608 { | 608 { |
609 if (!shadow || !shadow->isShadowRoot()) { | 609 if (!shadow || !shadow->isShadowRoot()) { |
610 ec = INVALID_ACCESS_ERR; | 610 ec = InvalidAccessError; |
611 return 0; | 611 return 0; |
612 } | 612 } |
613 | 613 |
614 return toShadowRoot(shadow)->olderShadowRoot(); | 614 return toShadowRoot(shadow)->olderShadowRoot(); |
615 } | 615 } |
616 | 616 |
617 String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const | 617 String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const |
618 { | 618 { |
619 if (!root || !root->isShadowRoot()) { | 619 if (!root || !root->isShadowRoot()) { |
620 ec = INVALID_ACCESS_ERR; | 620 ec = InvalidAccessError; |
621 return String(); | 621 return String(); |
622 } | 622 } |
623 | 623 |
624 switch (toShadowRoot(root)->type()) { | 624 switch (toShadowRoot(root)->type()) { |
625 case ShadowRoot::UserAgentShadowRoot: | 625 case ShadowRoot::UserAgentShadowRoot: |
626 return String("UserAgentShadowRoot"); | 626 return String("UserAgentShadowRoot"); |
627 case ShadowRoot::AuthorShadowRoot: | 627 case ShadowRoot::AuthorShadowRoot: |
628 return String("AuthorShadowRoot"); | 628 return String("AuthorShadowRoot"); |
629 default: | 629 default: |
630 ASSERT_NOT_REACHED(); | 630 ASSERT_NOT_REACHED(); |
631 return String("Unknown"); | 631 return String("Unknown"); |
632 } | 632 } |
633 } | 633 } |
634 | 634 |
635 Element* Internals::includerFor(Node* node, ExceptionCode& ec) | 635 Element* Internals::includerFor(Node* node, ExceptionCode& ec) |
636 { | 636 { |
637 if (!node) { | 637 if (!node) { |
638 ec = INVALID_ACCESS_ERR; | 638 ec = InvalidAccessError; |
639 return 0; | 639 return 0; |
640 } | 640 } |
641 | 641 |
642 return NodeRenderingContext(node).insertionPoint(); | 642 return NodeRenderingContext(node).insertionPoint(); |
643 } | 643 } |
644 | 644 |
645 String Internals::shadowPseudoId(Element* element, ExceptionCode& ec) | 645 String Internals::shadowPseudoId(Element* element, ExceptionCode& ec) |
646 { | 646 { |
647 if (!element) { | 647 if (!element) { |
648 ec = INVALID_ACCESS_ERR; | 648 ec = InvalidAccessError; |
649 return String(); | 649 return String(); |
650 } | 650 } |
651 | 651 |
652 return element->shadowPseudoId().string(); | 652 return element->shadowPseudoId().string(); |
653 } | 653 } |
654 | 654 |
655 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionC
ode& ec) | 655 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionC
ode& ec) |
656 { | 656 { |
657 if (!element) { | 657 if (!element) { |
658 ec = INVALID_ACCESS_ERR; | 658 ec = InvalidAccessError; |
659 return; | 659 return; |
660 } | 660 } |
661 | 661 |
662 return element->setPseudo(id); | 662 return element->setPseudo(id); |
663 } | 663 } |
664 | 664 |
665 String Internals::visiblePlaceholder(Element* element) | 665 String Internals::visiblePlaceholder(Element* element) |
666 { | 666 { |
667 if (element && isHTMLTextFormControlElement(element)) { | 667 if (element && isHTMLTextFormControlElement(element)) { |
668 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible()) | 668 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible()) |
669 return toHTMLTextFormControlElement(element)->placeholderElement()->
textContent(); | 669 return toHTMLTextFormControlElement(element)->placeholderElement()->
textContent(); |
670 } | 670 } |
671 | 671 |
672 return String(); | 672 return String(); |
673 } | 673 } |
674 | 674 |
675 void Internals::selectColorInColorChooser(Element* element, const String& colorV
alue) | 675 void Internals::selectColorInColorChooser(Element* element, const String& colorV
alue) |
676 { | 676 { |
677 if (!element->hasTagName(inputTag)) | 677 if (!element->hasTagName(inputTag)) |
678 return; | 678 return; |
679 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); | 679 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); |
680 } | 680 } |
681 | 681 |
682 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& e
c) | 682 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& e
c) |
683 { | 683 { |
684 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); | 684 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); |
685 if (!mainItem) { | 685 if (!mainItem) { |
686 ec = INVALID_ACCESS_ERR; | 686 ec = InvalidAccessError; |
687 return Vector<String>(); | 687 return Vector<String>(); |
688 } | 688 } |
689 String uniqueName = frame()->tree()->uniqueName(); | 689 String uniqueName = frame()->tree()->uniqueName(); |
690 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu
eName)) { | 690 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu
eName)) { |
691 ec = INVALID_ACCESS_ERR; | 691 ec = InvalidAccessError; |
692 return Vector<String>(); | 692 return Vector<String>(); |
693 } | 693 } |
694 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt
em->childItemWithTarget(uniqueName)->documentState(); | 694 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt
em->childItemWithTarget(uniqueName)->documentState(); |
695 } | 695 } |
696 | 696 |
697 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s
tate, ExceptionCode& ec) | 697 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s
tate, ExceptionCode& ec) |
698 { | 698 { |
699 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); | 699 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); |
700 if (!mainItem) { | 700 if (!mainItem) { |
701 ec = INVALID_ACCESS_ERR; | 701 ec = InvalidAccessError; |
702 return; | 702 return; |
703 } | 703 } |
704 String uniqueName = frame()->tree()->uniqueName(); | 704 String uniqueName = frame()->tree()->uniqueName(); |
705 if (mainItem->target() == uniqueName) | 705 if (mainItem->target() == uniqueName) |
706 mainItem->setDocumentState(state); | 706 mainItem->setDocumentState(state); |
707 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) | 707 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) |
708 subItem->setDocumentState(state); | 708 subItem->setDocumentState(state); |
709 else | 709 else |
710 ec = INVALID_ACCESS_ERR; | 710 ec = InvalidAccessError; |
711 } | 711 } |
712 | 712 |
713 void Internals::enableMockSpeechSynthesizer() | 713 void Internals::enableMockSpeechSynthesizer() |
714 { | 714 { |
715 Document* document = contextDocument(); | 715 Document* document = contextDocument(); |
716 if (!document || !document->domWindow()) | 716 if (!document || !document->domWindow()) |
717 return; | 717 return; |
718 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum
ent->domWindow()); | 718 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum
ent->domWindow()); |
719 if (!synthesis) | 719 if (!synthesis) |
720 return; | 720 return; |
(...skipping 18 matching lines...) Expand all Loading... |
739 | 739 |
740 PassRefPtr<PagePopupController> Internals::pagePopupController() | 740 PassRefPtr<PagePopupController> Internals::pagePopupController() |
741 { | 741 { |
742 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; | 742 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; |
743 } | 743 } |
744 | 744 |
745 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionCode& ec) | 745 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionCode& ec) |
746 { | 746 { |
747 Document* document = contextDocument(); | 747 Document* document = contextDocument(); |
748 if (!document || !document->view()) { | 748 if (!document || !document->view()) { |
749 ec = INVALID_ACCESS_ERR; | 749 ec = InvalidAccessError; |
750 return ClientRect::create(); | 750 return ClientRect::create(); |
751 } | 751 } |
752 | 752 |
753 return ClientRect::create(document->view()->visibleContentRect()); | 753 return ClientRect::create(document->view()->visibleContentRect()); |
754 } | 754 } |
755 | 755 |
756 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec) | 756 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec) |
757 { | 757 { |
758 Document* document = contextDocument(); | 758 Document* document = contextDocument(); |
759 if (!document || !document->frame() || !document->frame()->selection()) { | 759 if (!document || !document->frame() || !document->frame()->selection()) { |
760 ec = INVALID_ACCESS_ERR; | 760 ec = InvalidAccessError; |
761 return ClientRect::create(); | 761 return ClientRect::create(); |
762 } | 762 } |
763 | 763 |
764 return ClientRect::create(document->frame()->selection()->absoluteCaretBound
s()); | 764 return ClientRect::create(document->frame()->selection()->absoluteCaretBound
s()); |
765 } | 765 } |
766 | 766 |
767 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& e
c) | 767 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& e
c) |
768 { | 768 { |
769 if (!element) { | 769 if (!element) { |
770 ec = INVALID_ACCESS_ERR; | 770 ec = InvalidAccessError; |
771 return ClientRect::create(); | 771 return ClientRect::create(); |
772 } | 772 } |
773 | 773 |
774 element->document()->updateLayoutIgnorePendingStylesheets(); | 774 element->document()->updateLayoutIgnorePendingStylesheets(); |
775 RenderObject* renderer = element->renderer(); | 775 RenderObject* renderer = element->renderer(); |
776 if (!renderer) | 776 if (!renderer) |
777 return ClientRect::create(); | 777 return ClientRect::create(); |
778 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform
s()); | 778 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform
s()); |
779 } | 779 } |
780 | 780 |
781 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document
, ExceptionCode& ec) | 781 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document
, ExceptionCode& ec) |
782 { | 782 { |
783 if (!document || !document->page() || !document->page()->inspectorController
()) { | 783 if (!document || !document->page() || !document->page()->inspectorController
()) { |
784 ec = INVALID_ACCESS_ERR; | 784 ec = InvalidAccessError; |
785 return ClientRectList::create(); | 785 return ClientRectList::create(); |
786 } | 786 } |
787 | 787 |
788 Highlight highlight; | 788 Highlight highlight; |
789 document->page()->inspectorController()->getHighlight(&highlight); | 789 document->page()->inspectorController()->getHighlight(&highlight); |
790 return ClientRectList::create(highlight.quads); | 790 return ClientRectList::create(highlight.quads); |
791 } | 791 } |
792 | 792 |
793 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc
eptionCode& ec) | 793 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc
eptionCode& ec) |
794 { | 794 { |
795 if (!node) { | 795 if (!node) { |
796 ec = INVALID_ACCESS_ERR; | 796 ec = InvalidAccessError; |
797 return 0; | 797 return 0; |
798 } | 798 } |
799 | 799 |
800 DocumentMarker::MarkerTypes markerTypes = 0; | 800 DocumentMarker::MarkerTypes markerTypes = 0; |
801 if (!markerTypesFrom(markerType, markerTypes)) { | 801 if (!markerTypesFrom(markerType, markerTypes)) { |
802 ec = SYNTAX_ERR; | 802 ec = SyntaxError; |
803 return 0; | 803 return 0; |
804 } | 804 } |
805 | 805 |
806 return node->document()->markers()->markersFor(node, markerTypes).size(); | 806 return node->document()->markers()->markersFor(node, markerTypes).size(); |
807 } | 807 } |
808 | 808 |
809 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign
ed index, ExceptionCode& ec) | 809 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign
ed index, ExceptionCode& ec) |
810 { | 810 { |
811 if (!node) { | 811 if (!node) { |
812 ec = INVALID_ACCESS_ERR; | 812 ec = InvalidAccessError; |
813 return 0; | 813 return 0; |
814 } | 814 } |
815 | 815 |
816 DocumentMarker::MarkerTypes markerTypes = 0; | 816 DocumentMarker::MarkerTypes markerTypes = 0; |
817 if (!markerTypesFrom(markerType, markerTypes)) { | 817 if (!markerTypesFrom(markerType, markerTypes)) { |
818 ec = SYNTAX_ERR; | 818 ec = SyntaxError; |
819 return 0; | 819 return 0; |
820 } | 820 } |
821 | 821 |
822 Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(no
de, markerTypes); | 822 Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(no
de, markerTypes); |
823 if (markers.size() <= index) | 823 if (markers.size() <= index) |
824 return 0; | 824 return 0; |
825 return markers[index]; | 825 return markers[index]; |
826 } | 826 } |
827 | 827 |
828 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker
Type, unsigned index, ExceptionCode& ec) | 828 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker
Type, unsigned index, ExceptionCode& ec) |
(...skipping 14 matching lines...) Expand all Loading... |
843 | 843 |
844 void Internals::addTextMatchMarker(const Range* range, bool isActive) | 844 void Internals::addTextMatchMarker(const Range* range, bool isActive) |
845 { | 845 { |
846 range->ownerDocument()->updateLayoutIgnorePendingStylesheets(); | 846 range->ownerDocument()->updateLayoutIgnorePendingStylesheets(); |
847 range->ownerDocument()->markers()->addTextMatchMarker(range, isActive); | 847 range->ownerDocument()->markers()->addTextMatchMarker(range, isActive); |
848 } | 848 } |
849 | 849 |
850 void Internals::setScrollViewPosition(Document* document, long x, long y, Except
ionCode& ec) | 850 void Internals::setScrollViewPosition(Document* document, long x, long y, Except
ionCode& ec) |
851 { | 851 { |
852 if (!document || !document->view()) { | 852 if (!document || !document->view()) { |
853 ec = INVALID_ACCESS_ERR; | 853 ec = InvalidAccessError; |
854 return; | 854 return; |
855 } | 855 } |
856 | 856 |
857 FrameView* frameView = document->view(); | 857 FrameView* frameView = document->view(); |
858 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli
ngToContentEdge(); | 858 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli
ngToContentEdge(); |
859 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); | 859 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); |
860 | 860 |
861 frameView->setConstrainsScrollingToContentEdge(false); | 861 frameView->setConstrainsScrollingToContentEdge(false); |
862 frameView->setScrollbarsSuppressed(false); | 862 frameView->setScrollbarsSuppressed(false); |
863 frameView->setScrollOffsetFromInternals(IntPoint(x, y)); | 863 frameView->setScrollOffsetFromInternals(IntPoint(x, y)); |
864 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); | 864 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); |
865 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE
dgeOldValue); | 865 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE
dgeOldValue); |
866 } | 866 } |
867 | 867 |
868 void Internals::setPagination(Document* document, const String& mode, int gap, i
nt pageLength, ExceptionCode& ec) | 868 void Internals::setPagination(Document* document, const String& mode, int gap, i
nt pageLength, ExceptionCode& ec) |
869 { | 869 { |
870 if (!document || !document->page()) { | 870 if (!document || !document->page()) { |
871 ec = INVALID_ACCESS_ERR; | 871 ec = InvalidAccessError; |
872 return; | 872 return; |
873 } | 873 } |
874 Page* page = document->page(); | 874 Page* page = document->page(); |
875 | 875 |
876 Pagination pagination; | 876 Pagination pagination; |
877 if (mode == "Unpaginated") | 877 if (mode == "Unpaginated") |
878 pagination.mode = Pagination::Unpaginated; | 878 pagination.mode = Pagination::Unpaginated; |
879 else if (mode == "LeftToRightPaginated") | 879 else if (mode == "LeftToRightPaginated") |
880 pagination.mode = Pagination::LeftToRightPaginated; | 880 pagination.mode = Pagination::LeftToRightPaginated; |
881 else if (mode == "RightToLeftPaginated") | 881 else if (mode == "RightToLeftPaginated") |
882 pagination.mode = Pagination::RightToLeftPaginated; | 882 pagination.mode = Pagination::RightToLeftPaginated; |
883 else if (mode == "TopToBottomPaginated") | 883 else if (mode == "TopToBottomPaginated") |
884 pagination.mode = Pagination::TopToBottomPaginated; | 884 pagination.mode = Pagination::TopToBottomPaginated; |
885 else if (mode == "BottomToTopPaginated") | 885 else if (mode == "BottomToTopPaginated") |
886 pagination.mode = Pagination::BottomToTopPaginated; | 886 pagination.mode = Pagination::BottomToTopPaginated; |
887 else { | 887 else { |
888 ec = SYNTAX_ERR; | 888 ec = SyntaxError; |
889 return; | 889 return; |
890 } | 890 } |
891 | 891 |
892 pagination.gap = gap; | 892 pagination.gap = gap; |
893 pagination.pageLength = pageLength; | 893 pagination.pageLength = pageLength; |
894 page->setPagination(pagination); | 894 page->setPagination(pagination); |
895 } | 895 } |
896 | 896 |
897 String Internals::configurationForViewport(Document* document, float devicePixel
Ratio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeigh
t, ExceptionCode& ec) | 897 String Internals::configurationForViewport(Document* document, float devicePixel
Ratio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeigh
t, ExceptionCode& ec) |
898 { | 898 { |
899 if (!document || !document->page()) { | 899 if (!document || !document->page()) { |
900 ec = INVALID_ACCESS_ERR; | 900 ec = InvalidAccessError; |
901 return String(); | 901 return String(); |
902 } | 902 } |
903 Page* page = document->page(); | 903 Page* page = document->page(); |
904 | 904 |
905 const int defaultLayoutWidthForNonMobilePages = 980; | 905 const int defaultLayoutWidthForNonMobilePages = 980; |
906 | 906 |
907 // FIXME(aelias): Remove this argument from all the fast/viewport tests. | 907 // FIXME(aelias): Remove this argument from all the fast/viewport tests. |
908 ASSERT(devicePixelRatio == 1); | 908 ASSERT(devicePixelRatio == 1); |
909 | 909 |
910 ViewportArguments arguments = page->viewportArguments(); | 910 ViewportArguments arguments = page->viewportArguments(); |
911 PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth,
availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNo
nMobilePages); | 911 PageScaleConstraints constraints = arguments.resolve(IntSize(availableWidth,
availableHeight), FloatSize(deviceWidth, deviceHeight), defaultLayoutWidthForNo
nMobilePages); |
912 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt
h); | 912 constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidt
h); |
913 | 913 |
914 return "viewport size " + String::number(constraints.layoutSize.width()) + "
x" + String::number(constraints.layoutSize.height()) + " scale " + String::numbe
r(constraints.initialScale) + " with limits [" + String::number(constraints.mini
mumScale) + ", " + String::number(constraints.maximumScale) + "] and userScalabl
e " + (arguments.userZoom ? "true" : "false"); | 914 return "viewport size " + String::number(constraints.layoutSize.width()) + "
x" + String::number(constraints.layoutSize.height()) + " scale " + String::numbe
r(constraints.initialScale) + " with limits [" + String::number(constraints.mini
mumScale) + ", " + String::number(constraints.maximumScale) + "] and userScalabl
e " + (arguments.userZoom ? "true" : "false"); |
915 } | 915 } |
916 | 916 |
917 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) | 917 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) |
918 { | 918 { |
919 if (!textField) { | 919 if (!textField) { |
920 ec = INVALID_ACCESS_ERR; | 920 ec = InvalidAccessError; |
921 return false; | 921 return false; |
922 } | 922 } |
923 | 923 |
924 if (textField->hasTagName(inputTag)) | 924 if (textField->hasTagName(inputTag)) |
925 return toHTMLInputElement(textField)->lastChangeWasUserEdit(); | 925 return toHTMLInputElement(textField)->lastChangeWasUserEdit(); |
926 | 926 |
927 // FIXME: We should be using hasTagName instead but Windows port doesn't lin
k QualifiedNames properly. | 927 // FIXME: We should be using hasTagName instead but Windows port doesn't lin
k QualifiedNames properly. |
928 if (textField->tagName() == "TEXTAREA") | 928 if (textField->tagName() == "TEXTAREA") |
929 return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEd
it(); | 929 return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEd
it(); |
930 | 930 |
931 ec = INVALID_NODE_TYPE_ERR; | 931 ec = INVALID_NODE_TYPE_ERR; |
932 return false; | 932 return false; |
933 } | 933 } |
934 | 934 |
935 bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec) | 935 bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec) |
936 { | 936 { |
937 if (!element) { | 937 if (!element) { |
938 ec = INVALID_ACCESS_ERR; | 938 ec = InvalidAccessError; |
939 return false; | 939 return false; |
940 } | 940 } |
941 | 941 |
942 if (element->hasTagName(inputTag)) | 942 if (element->hasTagName(inputTag)) |
943 return toHTMLInputElement(element)->shouldAutocomplete(); | 943 return toHTMLInputElement(element)->shouldAutocomplete(); |
944 | 944 |
945 ec = INVALID_NODE_TYPE_ERR; | 945 ec = INVALID_NODE_TYPE_ERR; |
946 return false; | 946 return false; |
947 } | 947 } |
948 | 948 |
949 String Internals::suggestedValue(Element* element, ExceptionCode& ec) | 949 String Internals::suggestedValue(Element* element, ExceptionCode& ec) |
950 { | 950 { |
951 if (!element) { | 951 if (!element) { |
952 ec = INVALID_ACCESS_ERR; | 952 ec = InvalidAccessError; |
953 return String(); | 953 return String(); |
954 } | 954 } |
955 | 955 |
956 if (!element->hasTagName(inputTag)) { | 956 if (!element->hasTagName(inputTag)) { |
957 ec = INVALID_NODE_TYPE_ERR; | 957 ec = INVALID_NODE_TYPE_ERR; |
958 return String(); | 958 return String(); |
959 } | 959 } |
960 | 960 |
961 return toHTMLInputElement(element)->suggestedValue(); | 961 return toHTMLInputElement(element)->suggestedValue(); |
962 } | 962 } |
963 | 963 |
964 void Internals::setSuggestedValue(Element* element, const String& value, Excepti
onCode& ec) | 964 void Internals::setSuggestedValue(Element* element, const String& value, Excepti
onCode& ec) |
965 { | 965 { |
966 if (!element) { | 966 if (!element) { |
967 ec = INVALID_ACCESS_ERR; | 967 ec = InvalidAccessError; |
968 return; | 968 return; |
969 } | 969 } |
970 | 970 |
971 if (!element->hasTagName(inputTag)) { | 971 if (!element->hasTagName(inputTag)) { |
972 ec = INVALID_NODE_TYPE_ERR; | 972 ec = INVALID_NODE_TYPE_ERR; |
973 return; | 973 return; |
974 } | 974 } |
975 | 975 |
976 toHTMLInputElement(element)->setSuggestedValue(value); | 976 toHTMLInputElement(element)->setSuggestedValue(value); |
977 } | 977 } |
978 | 978 |
979 void Internals::setEditingValue(Element* element, const String& value, Exception
Code& ec) | 979 void Internals::setEditingValue(Element* element, const String& value, Exception
Code& ec) |
980 { | 980 { |
981 if (!element) { | 981 if (!element) { |
982 ec = INVALID_ACCESS_ERR; | 982 ec = InvalidAccessError; |
983 return; | 983 return; |
984 } | 984 } |
985 | 985 |
986 if (!element->hasTagName(inputTag)) { | 986 if (!element->hasTagName(inputTag)) { |
987 ec = INVALID_NODE_TYPE_ERR; | 987 ec = INVALID_NODE_TYPE_ERR; |
988 return; | 988 return; |
989 } | 989 } |
990 | 990 |
991 toHTMLInputElement(element)->setEditingValue(value); | 991 toHTMLInputElement(element)->setEditingValue(value); |
992 } | 992 } |
993 | 993 |
994 void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec) | 994 void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec) |
995 { | 995 { |
996 if (!element->hasTagName(inputTag)) { | 996 if (!element->hasTagName(inputTag)) { |
997 ec = INVALID_ACCESS_ERR; | 997 ec = InvalidAccessError; |
998 return; | 998 return; |
999 } | 999 } |
1000 toHTMLInputElement(element)->setAutofilled(enabled); | 1000 toHTMLInputElement(element)->setAutofilled(enabled); |
1001 } | 1001 } |
1002 | 1002 |
1003 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo
ng h, ExceptionCode& ec) | 1003 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo
ng h, ExceptionCode& ec) |
1004 { | 1004 { |
1005 if (!element || !element->document() || !element->document()->view()) { | 1005 if (!element || !element->document() || !element->document()->view()) { |
1006 ec = INVALID_ACCESS_ERR; | 1006 ec = InvalidAccessError; |
1007 return; | 1007 return; |
1008 } | 1008 } |
1009 FrameView* frameView = element->document()->view(); | 1009 FrameView* frameView = element->document()->view(); |
1010 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); | 1010 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); |
1011 } | 1011 } |
1012 | 1012 |
1013 void Internals::paintControlTints(Document* document, ExceptionCode& ec) | 1013 void Internals::paintControlTints(Document* document, ExceptionCode& ec) |
1014 { | 1014 { |
1015 if (!document || !document->view()) { | 1015 if (!document || !document->view()) { |
1016 ec = INVALID_ACCESS_ERR; | 1016 ec = InvalidAccessError; |
1017 return; | 1017 return; |
1018 } | 1018 } |
1019 | 1019 |
1020 FrameView* frameView = document->view(); | 1020 FrameView* frameView = document->view(); |
1021 frameView->paintControlTints(); | 1021 frameView->paintControlTints(); |
1022 } | 1022 } |
1023 | 1023 |
1024 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang
eLocation, int rangeLength, ExceptionCode& ec) | 1024 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang
eLocation, int rangeLength, ExceptionCode& ec) |
1025 { | 1025 { |
1026 if (!scope) { | 1026 if (!scope) { |
1027 ec = INVALID_ACCESS_ERR; | 1027 ec = InvalidAccessError; |
1028 return 0; | 1028 return 0; |
1029 } | 1029 } |
1030 | 1030 |
1031 return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeL
ength); | 1031 return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeL
ength); |
1032 } | 1032 } |
1033 | 1033 |
1034 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except
ionCode& ec) | 1034 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except
ionCode& ec) |
1035 { | 1035 { |
1036 if (!scope || !range) { | 1036 if (!scope || !range) { |
1037 ec = INVALID_ACCESS_ERR; | 1037 ec = InvalidAccessError; |
1038 return 0; | 1038 return 0; |
1039 } | 1039 } |
1040 | 1040 |
1041 size_t location = 0; | 1041 size_t location = 0; |
1042 size_t unusedLength = 0; | 1042 size_t unusedLength = 0; |
1043 TextIterator::getLocationAndLengthFromRange(scope, range, location, unusedLe
ngth); | 1043 TextIterator::getLocationAndLengthFromRange(scope, range, location, unusedLe
ngth); |
1044 return location; | 1044 return location; |
1045 } | 1045 } |
1046 | 1046 |
1047 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio
nCode& ec) | 1047 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio
nCode& ec) |
1048 { | 1048 { |
1049 if (!scope || !range) { | 1049 if (!scope || !range) { |
1050 ec = INVALID_ACCESS_ERR; | 1050 ec = InvalidAccessError; |
1051 return 0; | 1051 return 0; |
1052 } | 1052 } |
1053 | 1053 |
1054 size_t unusedLocation = 0; | 1054 size_t unusedLocation = 0; |
1055 size_t length = 0; | 1055 size_t length = 0; |
1056 TextIterator::getLocationAndLengthFromRange(scope, range, unusedLocation, le
ngth); | 1056 TextIterator::getLocationAndLengthFromRange(scope, range, unusedLocation, le
ngth); |
1057 return length; | 1057 return length; |
1058 } | 1058 } |
1059 | 1059 |
1060 String Internals::rangeAsText(const Range* range, ExceptionCode& ec) | 1060 String Internals::rangeAsText(const Range* range, ExceptionCode& ec) |
1061 { | 1061 { |
1062 if (!range) { | 1062 if (!range) { |
1063 ec = INVALID_ACCESS_ERR; | 1063 ec = InvalidAccessError; |
1064 return String(); | 1064 return String(); |
1065 } | 1065 } |
1066 | 1066 |
1067 return range->text(); | 1067 return range->text(); |
1068 } | 1068 } |
1069 | 1069 |
1070 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x,
long y, long width, long height, Document* document, ExceptionCode& ec) | 1070 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x,
long y, long width, long height, Document* document, ExceptionCode& ec) |
1071 { | 1071 { |
1072 if (!document || !document->frame()) { | 1072 if (!document || !document->frame()) { |
1073 ec = INVALID_ACCESS_ERR; | 1073 ec = InvalidAccessError; |
1074 return 0; | 1074 return 0; |
1075 } | 1075 } |
1076 | 1076 |
1077 document->updateLayout(); | 1077 document->updateLayout(); |
1078 | 1078 |
1079 IntSize radius(width / 2, height / 2); | 1079 IntSize radius(width / 2, height / 2); |
1080 IntPoint point(x + radius.width(), y + radius.height()); | 1080 IntPoint point(x + radius.width(), y + radius.height()); |
1081 | 1081 |
1082 Node* targetNode; | 1082 Node* targetNode; |
1083 IntPoint adjustedPoint; | 1083 IntPoint adjustedPoint; |
1084 | 1084 |
1085 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc
hPoint(point, radius, adjustedPoint, targetNode); | 1085 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc
hPoint(point, radius, adjustedPoint, targetNode); |
1086 if (foundNode) | 1086 if (foundNode) |
1087 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1087 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
1088 | 1088 |
1089 return 0; | 1089 return 0; |
1090 } | 1090 } |
1091 | 1091 |
1092 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionCode& ec) | 1092 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionCode& ec) |
1093 { | 1093 { |
1094 if (!document || !document->frame()) { | 1094 if (!document || !document->frame()) { |
1095 ec = INVALID_ACCESS_ERR; | 1095 ec = InvalidAccessError; |
1096 return 0; | 1096 return 0; |
1097 } | 1097 } |
1098 | 1098 |
1099 document->updateLayout(); | 1099 document->updateLayout(); |
1100 | 1100 |
1101 IntSize radius(width / 2, height / 2); | 1101 IntSize radius(width / 2, height / 2); |
1102 IntPoint point(x + radius.width(), y + radius.height()); | 1102 IntPoint point(x + radius.width(), y + radius.height()); |
1103 | 1103 |
1104 Node* targetNode; | 1104 Node* targetNode; |
1105 IntPoint adjustedPoint; | 1105 IntPoint adjustedPoint; |
1106 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad
ius, adjustedPoint, targetNode); | 1106 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad
ius, adjustedPoint, targetNode); |
1107 return targetNode; | 1107 return targetNode; |
1108 } | 1108 } |
1109 | 1109 |
1110 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long
x, long y, long width, long height, Document* document, ExceptionCode& ec) | 1110 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long
x, long y, long width, long height, Document* document, ExceptionCode& ec) |
1111 { | 1111 { |
1112 if (!document || !document->frame()) { | 1112 if (!document || !document->frame()) { |
1113 ec = INVALID_ACCESS_ERR; | 1113 ec = InvalidAccessError; |
1114 return 0; | 1114 return 0; |
1115 } | 1115 } |
1116 | 1116 |
1117 document->updateLayout(); | 1117 document->updateLayout(); |
1118 | 1118 |
1119 IntSize radius(width / 2, height / 2); | 1119 IntSize radius(width / 2, height / 2); |
1120 IntPoint point(x + radius.width(), y + radius.height()); | 1120 IntPoint point(x + radius.width(), y + radius.height()); |
1121 | 1121 |
1122 Node* targetNode = 0; | 1122 Node* targetNode = 0; |
1123 IntPoint adjustedPoint; | 1123 IntPoint adjustedPoint; |
1124 | 1124 |
1125 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo
uchPoint(point, radius, adjustedPoint, targetNode); | 1125 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo
uchPoint(point, radius, adjustedPoint, targetNode); |
1126 if (foundNode) | 1126 if (foundNode) |
1127 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1127 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
1128 | 1128 |
1129 return DOMPoint::create(x, y); | 1129 return DOMPoint::create(x, y); |
1130 } | 1130 } |
1131 | 1131 |
1132 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionCode& ec) | 1132 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionCode& ec) |
1133 { | 1133 { |
1134 if (!document || !document->frame()) { | 1134 if (!document || !document->frame()) { |
1135 ec = INVALID_ACCESS_ERR; | 1135 ec = InvalidAccessError; |
1136 return 0; | 1136 return 0; |
1137 } | 1137 } |
1138 | 1138 |
1139 document->updateLayout(); | 1139 document->updateLayout(); |
1140 | 1140 |
1141 IntSize radius(width / 2, height / 2); | 1141 IntSize radius(width / 2, height / 2); |
1142 IntPoint point(x + radius.width(), y + radius.height()); | 1142 IntPoint point(x + radius.width(), y + radius.height()); |
1143 | 1143 |
1144 Node* targetNode = 0; | 1144 Node* targetNode = 0; |
1145 IntPoint adjustedPoint; | 1145 IntPoint adjustedPoint; |
1146 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r
adius, adjustedPoint, targetNode); | 1146 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r
adius, adjustedPoint, targetNode); |
1147 return targetNode; | 1147 return targetNode; |
1148 } | 1148 } |
1149 | 1149 |
1150 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y,
long width, long height, Document* document, ExceptionCode& ec) | 1150 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y,
long width, long height, Document* document, ExceptionCode& ec) |
1151 { | 1151 { |
1152 if (!document || !document->frame()) { | 1152 if (!document || !document->frame()) { |
1153 ec = INVALID_ACCESS_ERR; | 1153 ec = InvalidAccessError; |
1154 return 0; | 1154 return 0; |
1155 } | 1155 } |
1156 | 1156 |
1157 document->updateLayout(); | 1157 document->updateLayout(); |
1158 | 1158 |
1159 IntSize radius(width / 2, height / 2); | 1159 IntSize radius(width / 2, height / 2); |
1160 IntPoint point(x + radius.width(), y + radius.height()); | 1160 IntPoint point(x + radius.width(), y + radius.height()); |
1161 | 1161 |
1162 Node* targetNode; | 1162 Node* targetNode; |
1163 IntRect zoomableArea; | 1163 IntRect zoomableArea; |
1164 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch
Point(point, radius, zoomableArea, targetNode); | 1164 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch
Point(point, radius, zoomableArea, targetNode); |
1165 if (foundNode) | 1165 if (foundNode) |
1166 return ClientRect::create(zoomableArea); | 1166 return ClientRect::create(zoomableArea); |
1167 | 1167 |
1168 return 0; | 1168 return 0; |
1169 } | 1169 } |
1170 | 1170 |
1171 | 1171 |
1172 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionCode&
ec) | 1172 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionCode&
ec) |
1173 { | 1173 { |
1174 SpellChecker* checker = spellchecker(document); | 1174 SpellChecker* checker = spellchecker(document); |
1175 | 1175 |
1176 if (!checker) { | 1176 if (!checker) { |
1177 ec = INVALID_ACCESS_ERR; | 1177 ec = InvalidAccessError; |
1178 return -1; | 1178 return -1; |
1179 } | 1179 } |
1180 | 1180 |
1181 return checker->lastRequestSequence(); | 1181 return checker->lastRequestSequence(); |
1182 } | 1182 } |
1183 | 1183 |
1184 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode
& ec) | 1184 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode
& ec) |
1185 { | 1185 { |
1186 SpellChecker* checker = spellchecker(document); | 1186 SpellChecker* checker = spellchecker(document); |
1187 | 1187 |
1188 if (!checker) { | 1188 if (!checker) { |
1189 ec = INVALID_ACCESS_ERR; | 1189 ec = InvalidAccessError; |
1190 return -1; | 1190 return -1; |
1191 } | 1191 } |
1192 | 1192 |
1193 return checker->lastProcessedSequence(); | 1193 return checker->lastProcessedSequence(); |
1194 } | 1194 } |
1195 | 1195 |
1196 Vector<String> Internals::userPreferredLanguages() const | 1196 Vector<String> Internals::userPreferredLanguages() const |
1197 { | 1197 { |
1198 return WebCore::userPreferredLanguages(); | 1198 return WebCore::userPreferredLanguages(); |
1199 } | 1199 } |
1200 | 1200 |
1201 void Internals::setUserPreferredLanguages(const Vector<String>& languages) | 1201 void Internals::setUserPreferredLanguages(const Vector<String>& languages) |
1202 { | 1202 { |
1203 WebCore::overrideUserPreferredLanguages(languages); | 1203 WebCore::overrideUserPreferredLanguages(languages); |
1204 } | 1204 } |
1205 | 1205 |
1206 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec
) | 1206 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec
) |
1207 { | 1207 { |
1208 if (!document) { | 1208 if (!document) { |
1209 ec = INVALID_ACCESS_ERR; | 1209 ec = InvalidAccessError; |
1210 return 0; | 1210 return 0; |
1211 } | 1211 } |
1212 | 1212 |
1213 return document->wheelEventHandlerCount(); | 1213 return document->wheelEventHandlerCount(); |
1214 } | 1214 } |
1215 | 1215 |
1216 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionCode& ec
) | 1216 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionCode& ec
) |
1217 { | 1217 { |
1218 if (!document) { | 1218 if (!document) { |
1219 ec = INVALID_ACCESS_ERR; | 1219 ec = InvalidAccessError; |
1220 return 0; | 1220 return 0; |
1221 } | 1221 } |
1222 | 1222 |
1223 const TouchEventTargetSet* touchHandlers = document->touchEventTargets(); | 1223 const TouchEventTargetSet* touchHandlers = document->touchEventTargets(); |
1224 if (!touchHandlers) | 1224 if (!touchHandlers) |
1225 return 0; | 1225 return 0; |
1226 | 1226 |
1227 unsigned count = 0; | 1227 unsigned count = 0; |
1228 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter
!= touchHandlers->end(); ++iter) | 1228 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter
!= touchHandlers->end(); ++iter) |
1229 count += iter->value; | 1229 count += iter->value; |
1230 return count; | 1230 return count; |
1231 } | 1231 } |
1232 | 1232 |
1233 PassRefPtr<ClientRectList> Internals::touchEventTargetClientRects(Document* docu
ment, ExceptionCode& ec) | 1233 PassRefPtr<ClientRectList> Internals::touchEventTargetClientRects(Document* docu
ment, ExceptionCode& ec) |
1234 { | 1234 { |
1235 if (!document || !document->view() || !document->page()) { | 1235 if (!document || !document->view() || !document->page()) { |
1236 ec = INVALID_ACCESS_ERR; | 1236 ec = InvalidAccessError; |
1237 return 0; | 1237 return 0; |
1238 } | 1238 } |
1239 if (!document->page()->scrollingCoordinator()) | 1239 if (!document->page()->scrollingCoordinator()) |
1240 return ClientRectList::create(); | 1240 return ClientRectList::create(); |
1241 | 1241 |
1242 document->updateLayoutIgnorePendingStylesheets(); | 1242 document->updateLayoutIgnorePendingStylesheets(); |
1243 | 1243 |
1244 Vector<IntRect> absoluteRects; | 1244 Vector<IntRect> absoluteRects; |
1245 document->page()->scrollingCoordinator()->computeAbsoluteTouchEventTargetRec
ts(document, absoluteRects); | 1245 document->page()->scrollingCoordinator()->computeAbsoluteTouchEventTargetRec
ts(document, absoluteRects); |
1246 Vector<FloatQuad> absoluteQuads(absoluteRects.size()); | 1246 Vector<FloatQuad> absoluteQuads(absoluteRects.size()); |
1247 | 1247 |
1248 for (size_t i = 0; i < absoluteRects.size(); ++i) | 1248 for (size_t i = 0; i < absoluteRects.size(); ++i) |
1249 absoluteQuads[i] = FloatQuad(absoluteRects[i]); | 1249 absoluteQuads[i] = FloatQuad(absoluteRects[i]); |
1250 | 1250 |
1251 return ClientRectList::create(absoluteQuads); | 1251 return ClientRectList::create(absoluteQuads); |
1252 } | 1252 } |
1253 | 1253 |
1254 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i
nt centerY, unsigned topPadding, unsigned rightPadding, | 1254 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i
nt centerY, unsigned topPadding, unsigned rightPadding, |
1255 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const | 1255 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const |
1256 { | 1256 { |
1257 if (!document || !document->frame() || !document->frame()->view()) { | 1257 if (!document || !document->frame() || !document->frame()->view()) { |
1258 ec = INVALID_ACCESS_ERR; | 1258 ec = InvalidAccessError; |
1259 return 0; | 1259 return 0; |
1260 } | 1260 } |
1261 | 1261 |
1262 Frame* frame = document->frame(); | 1262 Frame* frame = document->frame(); |
1263 FrameView* frameView = document->view(); | 1263 FrameView* frameView = document->view(); |
1264 RenderView* renderView = document->renderView(); | 1264 RenderView* renderView = document->renderView(); |
1265 | 1265 |
1266 if (!renderView) | 1266 if (!renderView) |
1267 return 0; | 1267 return 0; |
1268 | 1268 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 m_frontendChannel.release(); | 1407 m_frontendChannel.release(); |
1408 | 1408 |
1409 m_frontendWindow->close(m_frontendWindow->scriptExecutionContext()); | 1409 m_frontendWindow->close(m_frontendWindow->scriptExecutionContext()); |
1410 m_frontendWindow.release(); | 1410 m_frontendWindow.release(); |
1411 } | 1411 } |
1412 | 1412 |
1413 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS
ize, int maximumSingleResourceContentSize, ExceptionCode& ec) | 1413 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS
ize, int maximumSingleResourceContentSize, ExceptionCode& ec) |
1414 { | 1414 { |
1415 Page* page = contextDocument()->frame()->page(); | 1415 Page* page = contextDocument()->frame()->page(); |
1416 if (!page || !page->inspectorController()) { | 1416 if (!page || !page->inspectorController()) { |
1417 ec = INVALID_ACCESS_ERR; | 1417 ec = InvalidAccessError; |
1418 return; | 1418 return; |
1419 } | 1419 } |
1420 page->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximum
ResourcesContentSize, maximumSingleResourceContentSize); | 1420 page->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximum
ResourcesContentSize, maximumSingleResourceContentSize); |
1421 } | 1421 } |
1422 | 1422 |
1423 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep
tionCode&) | 1423 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep
tionCode&) |
1424 { | 1424 { |
1425 if (!document || !document->frame()) | 1425 if (!document || !document->frame()) |
1426 return 0; | 1426 return 0; |
1427 | 1427 |
(...skipping 11 matching lines...) Expand all Loading... |
1439 if (child->view() && child->view()->scrollableAreas()) | 1439 if (child->view() && child->view()->scrollableAreas()) |
1440 count += child->view()->scrollableAreas()->size(); | 1440 count += child->view()->scrollableAreas()->size(); |
1441 } | 1441 } |
1442 | 1442 |
1443 return count; | 1443 return count; |
1444 } | 1444 } |
1445 | 1445 |
1446 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionCo
de& ec) | 1446 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionCo
de& ec) |
1447 { | 1447 { |
1448 if (!document) { | 1448 if (!document) { |
1449 ec = INVALID_ACCESS_ERR; | 1449 ec = InvalidAccessError; |
1450 return false; | 1450 return false; |
1451 } | 1451 } |
1452 | 1452 |
1453 return document->isPageBoxVisible(pageNumber); | 1453 return document->isPageBoxVisible(pageNumber); |
1454 } | 1454 } |
1455 | 1455 |
1456 String Internals::layerTreeAsText(Document* document, ExceptionCode& ec) const | 1456 String Internals::layerTreeAsText(Document* document, ExceptionCode& ec) const |
1457 { | 1457 { |
1458 return layerTreeAsText(document, 0, ec); | 1458 return layerTreeAsText(document, 0, ec); |
1459 } | 1459 } |
1460 | 1460 |
1461 String Internals::elementLayerTreeAsText(Element* element, ExceptionCode& ec) co
nst | 1461 String Internals::elementLayerTreeAsText(Element* element, ExceptionCode& ec) co
nst |
1462 { | 1462 { |
1463 return elementLayerTreeAsText(element, 0, ec); | 1463 return elementLayerTreeAsText(element, 0, ec); |
1464 } | 1464 } |
1465 | 1465 |
1466 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionCode& ec,
RenderLayer::PaintOrderListType type) | 1466 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionCode& ec,
RenderLayer::PaintOrderListType type) |
1467 { | 1467 { |
1468 if (!element) { | 1468 if (!element) { |
1469 ec = INVALID_ACCESS_ERR; | 1469 ec = InvalidAccessError; |
1470 return 0; | 1470 return 0; |
1471 } | 1471 } |
1472 | 1472 |
1473 element->document()->updateLayout(); | 1473 element->document()->updateLayout(); |
1474 | 1474 |
1475 RenderObject* renderer = element->renderer(); | 1475 RenderObject* renderer = element->renderer(); |
1476 if (!renderer || !renderer->isBox()) { | 1476 if (!renderer || !renderer->isBox()) { |
1477 ec = INVALID_ACCESS_ERR; | 1477 ec = InvalidAccessError; |
1478 return 0; | 1478 return 0; |
1479 } | 1479 } |
1480 | 1480 |
1481 RenderLayer* layer = toRenderBox(renderer)->layer(); | 1481 RenderLayer* layer = toRenderBox(renderer)->layer(); |
1482 if (!layer) { | 1482 if (!layer) { |
1483 ec = INVALID_ACCESS_ERR; | 1483 ec = InvalidAccessError; |
1484 return 0; | 1484 return 0; |
1485 } | 1485 } |
1486 | 1486 |
1487 Vector<RefPtr<Node> > nodes; | 1487 Vector<RefPtr<Node> > nodes; |
1488 layer->computePaintOrderList(type, nodes); | 1488 layer->computePaintOrderList(type, nodes); |
1489 return StaticNodeList::adopt(nodes); | 1489 return StaticNodeList::adopt(nodes); |
1490 } | 1490 } |
1491 | 1491 |
1492 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex
ceptionCode& ec) | 1492 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex
ceptionCode& ec) |
1493 { | 1493 { |
1494 return paintOrderList(element, ec, RenderLayer::BeforePromote); | 1494 return paintOrderList(element, ec, RenderLayer::BeforePromote); |
1495 } | 1495 } |
1496 | 1496 |
1497 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc
eptionCode& ec) | 1497 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc
eptionCode& ec) |
1498 { | 1498 { |
1499 return paintOrderList(element, ec, RenderLayer::AfterPromote); | 1499 return paintOrderList(element, ec, RenderLayer::AfterPromote); |
1500 } | 1500 } |
1501 | 1501 |
1502 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionC
ode& ec) const | 1502 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionC
ode& ec) const |
1503 { | 1503 { |
1504 if (!document || !document->frame()) { | 1504 if (!document || !document->frame()) { |
1505 ec = INVALID_ACCESS_ERR; | 1505 ec = InvalidAccessError; |
1506 return String(); | 1506 return String(); |
1507 } | 1507 } |
1508 | 1508 |
1509 return document->frame()->layerTreeAsText(flags); | 1509 return document->frame()->layerTreeAsText(flags); |
1510 } | 1510 } |
1511 | 1511 |
1512 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep
tionCode& ec) const | 1512 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep
tionCode& ec) const |
1513 { | 1513 { |
1514 if (!element) { | 1514 if (!element) { |
1515 ec = INVALID_ACCESS_ERR; | 1515 ec = InvalidAccessError; |
1516 return String(); | 1516 return String(); |
1517 } | 1517 } |
1518 | 1518 |
1519 element->document()->updateLayout(); | 1519 element->document()->updateLayout(); |
1520 | 1520 |
1521 RenderObject* renderer = element->renderer(); | 1521 RenderObject* renderer = element->renderer(); |
1522 if (!renderer || !renderer->isBox()) { | 1522 if (!renderer || !renderer->isBox()) { |
1523 ec = INVALID_ACCESS_ERR; | 1523 ec = InvalidAccessError; |
1524 return String(); | 1524 return String(); |
1525 } | 1525 } |
1526 | 1526 |
1527 RenderLayer* layer = toRenderBox(renderer)->layer(); | 1527 RenderLayer* layer = toRenderBox(renderer)->layer(); |
1528 if (!layer) { | 1528 if (!layer) { |
1529 ec = INVALID_ACCESS_ERR; | 1529 ec = InvalidAccessError; |
1530 return String(); | 1530 return String(); |
1531 } | 1531 } |
1532 | 1532 |
1533 if (!layer->backing() || !layer->backing()->graphicsLayer()) { | 1533 if (!layer->backing() || !layer->backing()->graphicsLayer()) { |
1534 // Don't raise exception in these cases which may be normally used in te
sts. | 1534 // Don't raise exception in these cases which may be normally used in te
sts. |
1535 return String(); | 1535 return String(); |
1536 } | 1536 } |
1537 | 1537 |
1538 return layer->backing()->graphicsLayer()->layerTreeAsText(flags); | 1538 return layer->backing()->graphicsLayer()->layerTreeAsText(flags); |
1539 } | 1539 } |
1540 | 1540 |
1541 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp
ositedScrolling, ExceptionCode& ec) | 1541 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp
ositedScrolling, ExceptionCode& ec) |
1542 { | 1542 { |
1543 if (!element) { | 1543 if (!element) { |
1544 ec = INVALID_ACCESS_ERR; | 1544 ec = InvalidAccessError; |
1545 return; | 1545 return; |
1546 } | 1546 } |
1547 | 1547 |
1548 element->document()->updateLayout(); | 1548 element->document()->updateLayout(); |
1549 | 1549 |
1550 RenderObject* renderer = element->renderer(); | 1550 RenderObject* renderer = element->renderer(); |
1551 if (!renderer || !renderer->isBox()) { | 1551 if (!renderer || !renderer->isBox()) { |
1552 ec = INVALID_ACCESS_ERR; | 1552 ec = InvalidAccessError; |
1553 return; | 1553 return; |
1554 } | 1554 } |
1555 | 1555 |
1556 RenderLayer* layer = toRenderBox(renderer)->layer(); | 1556 RenderLayer* layer = toRenderBox(renderer)->layer(); |
1557 if (!layer) { | 1557 if (!layer) { |
1558 ec = INVALID_ACCESS_ERR; | 1558 ec = InvalidAccessError; |
1559 return; | 1559 return; |
1560 } | 1560 } |
1561 | 1561 |
1562 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNeedsC
ompositedScrollingMode>(needsCompositedScrolling)); | 1562 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNeedsC
ompositedScrollingMode>(needsCompositedScrolling)); |
1563 } | 1563 } |
1564 | 1564 |
1565 String Internals::repaintRectsAsText(Document* document, ExceptionCode& ec) cons
t | 1565 String Internals::repaintRectsAsText(Document* document, ExceptionCode& ec) cons
t |
1566 { | 1566 { |
1567 if (!document || !document->frame()) { | 1567 if (!document || !document->frame()) { |
1568 ec = INVALID_ACCESS_ERR; | 1568 ec = InvalidAccessError; |
1569 return String(); | 1569 return String(); |
1570 } | 1570 } |
1571 | 1571 |
1572 return document->frame()->trackedRepaintRectsAsText(); | 1572 return document->frame()->trackedRepaintRectsAsText(); |
1573 } | 1573 } |
1574 | 1574 |
1575 String Internals::scrollingStateTreeAsText(Document* document, ExceptionCode& ec
) const | 1575 String Internals::scrollingStateTreeAsText(Document* document, ExceptionCode& ec
) const |
1576 { | 1576 { |
1577 return String(); | 1577 return String(); |
1578 } | 1578 } |
1579 | 1579 |
1580 String Internals::mainThreadScrollingReasons(Document* document, ExceptionCode&
ec) const | 1580 String Internals::mainThreadScrollingReasons(Document* document, ExceptionCode&
ec) const |
1581 { | 1581 { |
1582 if (!document || !document->frame()) { | 1582 if (!document || !document->frame()) { |
1583 ec = INVALID_ACCESS_ERR; | 1583 ec = InvalidAccessError; |
1584 return String(); | 1584 return String(); |
1585 } | 1585 } |
1586 | 1586 |
1587 Page* page = document->page(); | 1587 Page* page = document->page(); |
1588 if (!page) | 1588 if (!page) |
1589 return String(); | 1589 return String(); |
1590 | 1590 |
1591 return page->mainThreadScrollingReasonsAsText(); | 1591 return page->mainThreadScrollingReasonsAsText(); |
1592 } | 1592 } |
1593 | 1593 |
1594 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document,
ExceptionCode& ec) const | 1594 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document,
ExceptionCode& ec) const |
1595 { | 1595 { |
1596 if (!document || !document->frame()) { | 1596 if (!document || !document->frame()) { |
1597 ec = INVALID_ACCESS_ERR; | 1597 ec = InvalidAccessError; |
1598 return 0; | 1598 return 0; |
1599 } | 1599 } |
1600 | 1600 |
1601 Page* page = document->page(); | 1601 Page* page = document->page(); |
1602 if (!page) | 1602 if (!page) |
1603 return 0; | 1603 return 0; |
1604 | 1604 |
1605 return page->nonFastScrollableRects(document->frame()); | 1605 return page->nonFastScrollableRects(document->frame()); |
1606 } | 1606 } |
1607 | 1607 |
1608 void Internals::garbageCollectDocumentResources(Document* document, ExceptionCod
e& ec) const | 1608 void Internals::garbageCollectDocumentResources(Document* document, ExceptionCod
e& ec) const |
1609 { | 1609 { |
1610 if (!document) { | 1610 if (!document) { |
1611 ec = INVALID_ACCESS_ERR; | 1611 ec = InvalidAccessError; |
1612 return; | 1612 return; |
1613 } | 1613 } |
1614 | 1614 |
1615 CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader(
); | 1615 CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader(
); |
1616 if (!cachedResourceLoader) | 1616 if (!cachedResourceLoader) |
1617 return; | 1617 return; |
1618 cachedResourceLoader->garbageCollectDocumentResources(); | 1618 cachedResourceLoader->garbageCollectDocumentResources(); |
1619 } | 1619 } |
1620 | 1620 |
1621 void Internals::allowRoundingHacks() const | 1621 void Internals::allowRoundingHacks() const |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 { | 1681 { |
1682 if (!frame()) | 1682 if (!frame()) |
1683 return -1; | 1683 return -1; |
1684 | 1684 |
1685 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight)
); | 1685 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight)
); |
1686 } | 1686 } |
1687 | 1687 |
1688 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCod
e& ec) const | 1688 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCod
e& ec) const |
1689 { | 1689 { |
1690 if (!frame()) { | 1690 if (!frame()) { |
1691 ec = INVALID_ACCESS_ERR; | 1691 ec = InvalidAccessError; |
1692 return String(); | 1692 return String(); |
1693 } | 1693 } |
1694 | 1694 |
1695 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN
umber); | 1695 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN
umber); |
1696 } | 1696 } |
1697 | 1697 |
1698 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig
ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionC
ode& ec) const | 1698 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig
ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionC
ode& ec) const |
1699 { | 1699 { |
1700 if (!frame()) { | 1700 if (!frame()) { |
1701 ec = INVALID_ACCESS_ERR; | 1701 ec = InvalidAccessError; |
1702 return String(); | 1702 return String(); |
1703 } | 1703 } |
1704 | 1704 |
1705 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width,
height, marginTop, marginRight, marginBottom, marginLeft); | 1705 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width,
height, marginTop, marginRight, marginBottom, marginLeft); |
1706 } | 1706 } |
1707 | 1707 |
1708 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionCode& ec) | 1708 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionCode& ec) |
1709 { | 1709 { |
1710 Document* document = contextDocument(); | 1710 Document* document = contextDocument(); |
1711 if (!document || !document->page()) { | 1711 if (!document || !document->page()) { |
1712 ec = INVALID_ACCESS_ERR; | 1712 ec = InvalidAccessError; |
1713 return; | 1713 return; |
1714 } | 1714 } |
1715 Page* page = document->page(); | 1715 Page* page = document->page(); |
1716 page->setDeviceScaleFactor(scaleFactor); | 1716 page->setDeviceScaleFactor(scaleFactor); |
1717 } | 1717 } |
1718 | 1718 |
1719 void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCod
e& ec) | 1719 void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCod
e& ec) |
1720 { | 1720 { |
1721 Document* document = contextDocument(); | 1721 Document* document = contextDocument(); |
1722 if (!document || !document->page()) { | 1722 if (!document || !document->page()) { |
1723 ec = INVALID_ACCESS_ERR; | 1723 ec = InvalidAccessError; |
1724 return; | 1724 return; |
1725 } | 1725 } |
1726 Page* page = document->page(); | 1726 Page* page = document->page(); |
1727 page->setPageScaleFactor(scaleFactor, IntPoint(x, y)); | 1727 page->setPageScaleFactor(scaleFactor, IntPoint(x, y)); |
1728 } | 1728 } |
1729 | 1729 |
1730 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception
Code& ec) | 1730 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception
Code& ec) |
1731 { | 1731 { |
1732 if (!document || !document->page()) { | 1732 if (!document || !document->page()) { |
1733 ec = INVALID_ACCESS_ERR; | 1733 ec = InvalidAccessError; |
1734 return; | 1734 return; |
1735 } | 1735 } |
1736 document->page()->setIsCursorVisible(isVisible); | 1736 document->page()->setIsCursorVisible(isVisible); |
1737 } | 1737 } |
1738 | 1738 |
1739 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element*
element) | 1739 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element*
element) |
1740 { | 1740 { |
1741 if (!document) | 1741 if (!document) |
1742 return; | 1742 return; |
1743 FullscreenController::from(document)->webkitWillEnterFullScreenForElement(el
ement); | 1743 FullscreenController::from(document)->webkitWillEnterFullScreenForElement(el
ement); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 | 1786 |
1787 Vector<String> Internals::getReferencedFilePaths() const | 1787 Vector<String> Internals::getReferencedFilePaths() const |
1788 { | 1788 { |
1789 frame()->loader()->history()->saveDocumentAndScrollState(); | 1789 frame()->loader()->history()->saveDocumentAndScrollState(); |
1790 return FormController::getReferencedFilePaths(frame()->loader()->history()->
currentItem()->documentState()); | 1790 return FormController::getReferencedFilePaths(frame()->loader()->history()->
currentItem()->documentState()); |
1791 } | 1791 } |
1792 | 1792 |
1793 void Internals::startTrackingRepaints(Document* document, ExceptionCode& ec) | 1793 void Internals::startTrackingRepaints(Document* document, ExceptionCode& ec) |
1794 { | 1794 { |
1795 if (!document || !document->view()) { | 1795 if (!document || !document->view()) { |
1796 ec = INVALID_ACCESS_ERR; | 1796 ec = InvalidAccessError; |
1797 return; | 1797 return; |
1798 } | 1798 } |
1799 | 1799 |
1800 FrameView* frameView = document->view(); | 1800 FrameView* frameView = document->view(); |
1801 frameView->setTracksRepaints(true); | 1801 frameView->setTracksRepaints(true); |
1802 } | 1802 } |
1803 | 1803 |
1804 void Internals::stopTrackingRepaints(Document* document, ExceptionCode& ec) | 1804 void Internals::stopTrackingRepaints(Document* document, ExceptionCode& ec) |
1805 { | 1805 { |
1806 if (!document || !document->view()) { | 1806 if (!document || !document->view()) { |
1807 ec = INVALID_ACCESS_ERR; | 1807 ec = InvalidAccessError; |
1808 return; | 1808 return; |
1809 } | 1809 } |
1810 | 1810 |
1811 FrameView* frameView = document->view(); | 1811 FrameView* frameView = document->view(); |
1812 frameView->setTracksRepaints(false); | 1812 frameView->setTracksRepaints(false); |
1813 } | 1813 } |
1814 | 1814 |
1815 static const char* cursorTypeToString(Cursor::Type cursorType) | 1815 static const char* cursorTypeToString(Cursor::Type cursorType) |
1816 { | 1816 { |
1817 switch (cursorType) { | 1817 switch (cursorType) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 case Cursor::Custom: return "Custom"; | 1861 case Cursor::Custom: return "Custom"; |
1862 } | 1862 } |
1863 | 1863 |
1864 ASSERT_NOT_REACHED(); | 1864 ASSERT_NOT_REACHED(); |
1865 return "UNKNOWN"; | 1865 return "UNKNOWN"; |
1866 } | 1866 } |
1867 | 1867 |
1868 String Internals::getCurrentCursorInfo(Document* document, ExceptionCode& ec) | 1868 String Internals::getCurrentCursorInfo(Document* document, ExceptionCode& ec) |
1869 { | 1869 { |
1870 if (!document || !document->frame()) { | 1870 if (!document || !document->frame()) { |
1871 ec = INVALID_ACCESS_ERR; | 1871 ec = InvalidAccessError; |
1872 return String(); | 1872 return String(); |
1873 } | 1873 } |
1874 | 1874 |
1875 Cursor cursor = document->frame()->eventHandler()->currentMouseCursor(); | 1875 Cursor cursor = document->frame()->eventHandler()->currentMouseCursor(); |
1876 | 1876 |
1877 StringBuilder result; | 1877 StringBuilder result; |
1878 result.append("type="); | 1878 result.append("type="); |
1879 result.append(cursorTypeToString(cursor.type())); | 1879 result.append(cursorTypeToString(cursor.type())); |
1880 result.append(" hotSpot="); | 1880 result.append(" hotSpot="); |
1881 result.appendNumber(cursor.hotSpot().x()); | 1881 result.appendNumber(cursor.hotSpot().x()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 | 1918 |
1919 void Internals::forceReload(bool endToEnd) | 1919 void Internals::forceReload(bool endToEnd) |
1920 { | 1920 { |
1921 frame()->loader()->reload(endToEnd); | 1921 frame()->loader()->reload(endToEnd); |
1922 } | 1922 } |
1923 | 1923 |
1924 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionCode& ec) | 1924 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionCode& ec) |
1925 { | 1925 { |
1926 Document* document = contextDocument(); | 1926 Document* document = contextDocument(); |
1927 if (!document || !document->frame() || !document->frame()->selection()) { | 1927 if (!document || !document->frame() || !document->frame()->selection()) { |
1928 ec = INVALID_ACCESS_ERR; | 1928 ec = InvalidAccessError; |
1929 return 0; | 1929 return 0; |
1930 } | 1930 } |
1931 | 1931 |
1932 return ClientRect::create(document->frame()->selection()->bounds()); | 1932 return ClientRect::create(document->frame()->selection()->bounds()); |
1933 } | 1933 } |
1934 | 1934 |
1935 String Internals::markerTextForListItem(Element* element, ExceptionCode& ec) | 1935 String Internals::markerTextForListItem(Element* element, ExceptionCode& ec) |
1936 { | 1936 { |
1937 if (!element) { | 1937 if (!element) { |
1938 ec = INVALID_ACCESS_ERR; | 1938 ec = InvalidAccessError; |
1939 return String(); | 1939 return String(); |
1940 } | 1940 } |
1941 return WebCore::markerTextForListItem(element); | 1941 return WebCore::markerTextForListItem(element); |
1942 } | 1942 } |
1943 | 1943 |
1944 String Internals::getImageSourceURL(Element* element, ExceptionCode& ec) | 1944 String Internals::getImageSourceURL(Element* element, ExceptionCode& ec) |
1945 { | 1945 { |
1946 if (!element) { | 1946 if (!element) { |
1947 ec = INVALID_ACCESS_ERR; | 1947 ec = InvalidAccessError; |
1948 return String(); | 1948 return String(); |
1949 } | 1949 } |
1950 return element->imageSourceURL(); | 1950 return element->imageSourceURL(); |
1951 } | 1951 } |
1952 | 1952 |
1953 String Internals::baseURL(Document* document, ExceptionCode& ec) | 1953 String Internals::baseURL(Document* document, ExceptionCode& ec) |
1954 { | 1954 { |
1955 if (!document) { | 1955 if (!document) { |
1956 ec = INVALID_ACCESS_ERR; | 1956 ec = InvalidAccessError; |
1957 return String(); | 1957 return String(); |
1958 } | 1958 } |
1959 | 1959 |
1960 return document->baseURL().string(); | 1960 return document->baseURL().string(); |
1961 } | 1961 } |
1962 | 1962 |
1963 bool Internals::isSelectPopupVisible(Node* node) | 1963 bool Internals::isSelectPopupVisible(Node* node) |
1964 { | 1964 { |
1965 if (!isHTMLSelectElement(node)) | 1965 if (!isHTMLSelectElement(node)) |
1966 return false; | 1966 return false; |
1967 | 1967 |
1968 HTMLSelectElement* select = toHTMLSelectElement(node); | 1968 HTMLSelectElement* select = toHTMLSelectElement(node); |
1969 | 1969 |
1970 RenderObject* renderer = select->renderer(); | 1970 RenderObject* renderer = select->renderer(); |
1971 if (!renderer->isMenuList()) | 1971 if (!renderer->isMenuList()) |
1972 return false; | 1972 return false; |
1973 | 1973 |
1974 RenderMenuList* menuList = toRenderMenuList(renderer); | 1974 RenderMenuList* menuList = toRenderMenuList(renderer); |
1975 return menuList->popupIsVisible(); | 1975 return menuList->popupIsVisible(); |
1976 } | 1976 } |
1977 | 1977 |
1978 } | 1978 } |
OLD | NEW |