Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/testing/InternalSettings.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 void Internals::crash() 289 void Internals::crash()
290 { 290 {
291 CRASH(); 291 CRASH();
292 } 292 }
293 293
294 PassRefPtr<Element> Internals::createContentElement(ExceptionState& es) 294 PassRefPtr<Element> Internals::createContentElement(ExceptionState& es)
295 { 295 {
296 Document* document = contextDocument(); 296 Document* document = contextDocument();
297 if (!document) { 297 if (!document) {
298 es.throwDOMException(InvalidAccessError); 298 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
299 return 0; 299 return 0;
300 } 300 }
301 301
302 return HTMLContentElement::create(*document); 302 return HTMLContentElement::create(*document);
303 } 303 }
304 304
305 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& es ) 305 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& es )
306 { 306 {
307 if (!insertionPoint || !insertionPoint->isInsertionPoint()) { 307 if (!insertionPoint || !insertionPoint->isInsertionPoint()) {
308 es.throwDOMException(InvalidAccessError); 308 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
309 return false; 309 return false;
310 } 310 }
311 311
312 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid(); 312 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid();
313 } 313 }
314 314
315 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es) 315 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es)
316 { 316 {
317 if (!node) { 317 if (!node) {
318 es.throwDOMException(InvalidAccessError); 318 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
319 return 0; 319 return 0;
320 } 320 }
321 321
322 return node->treeScope().rootNode(); 322 return node->treeScope().rootNode();
323 } 323 }
324 324
325 Node* Internals::parentTreeScope(Node* node, ExceptionState& es) 325 Node* Internals::parentTreeScope(Node* node, ExceptionState& es)
326 { 326 {
327 if (!node) { 327 if (!node) {
328 es.throwDOMException(InvalidAccessError); 328 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
329 return 0; 329 return 0;
330 } 330 }
331 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); 331 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope();
332 return parentTreeScope ? parentTreeScope->rootNode() : 0; 332 return parentTreeScope ? parentTreeScope->rootNode() : 0;
333 } 333 }
334 334
335 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& es) 335 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& es)
336 { 336 {
337 if (!host || !host->shadow()) { 337 if (!host || !host->shadow()) {
338 es.throwDOMException(InvalidAccessError); 338 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
339 return 0; 339 return 0;
340 } 340 }
341 341
342 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); 342 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue);
343 } 343 }
344 344
345 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa me, ExceptionState& es) 345 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa me, ExceptionState& es)
346 { 346 {
347 if (!host || !host->shadow()) { 347 if (!host || !host->shadow()) {
348 es.throwDOMException(InvalidAccessError); 348 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
349 return 0; 349 return 0;
350 } 350 }
351 351
352 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam e); 352 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam e);
353 } 353 }
354 354
355 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att ributeName, ExceptionState& es) 355 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att ributeName, ExceptionState& es)
356 { 356 {
357 if (!host || !host->shadow()) { 357 if (!host || !host->shadow()) {
358 es.throwDOMException(InvalidAccessError); 358 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
359 return 0; 359 return 0;
360 } 360 }
361 361
362 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName); 362 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName);
363 } 363 }
364 364
365 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& es) 365 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& es)
366 { 366 {
367 if (!host || !host->shadow()) { 367 if (!host || !host->shadow()) {
368 es.throwDOMException(InvalidAccessError); 368 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
369 return 0; 369 return 0;
370 } 370 }
371 371
372 const SelectRuleFeatureSet& featureSet = host->shadow()->ensureSelectFeature Set(); 372 const SelectRuleFeatureSet& featureSet = host->shadow()->ensureSelectFeature Set();
373 if (pseudoClass == "checked") 373 if (pseudoClass == "checked")
374 return featureSet.hasSelectorForChecked(); 374 return featureSet.hasSelectorForChecked();
375 if (pseudoClass == "enabled") 375 if (pseudoClass == "enabled")
376 return featureSet.hasSelectorForEnabled(); 376 return featureSet.hasSelectorForEnabled();
377 if (pseudoClass == "disabled") 377 if (pseudoClass == "disabled")
378 return featureSet.hasSelectorForDisabled(); 378 return featureSet.hasSelectorForDisabled();
379 if (pseudoClass == "indeterminate") 379 if (pseudoClass == "indeterminate")
380 return featureSet.hasSelectorForIndeterminate(); 380 return featureSet.hasSelectorForIndeterminate();
381 if (pseudoClass == "link") 381 if (pseudoClass == "link")
382 return featureSet.hasSelectorForLink(); 382 return featureSet.hasSelectorForLink();
383 if (pseudoClass == "target") 383 if (pseudoClass == "target")
384 return featureSet.hasSelectorForTarget(); 384 return featureSet.hasSelectorForTarget();
385 if (pseudoClass == "visited") 385 if (pseudoClass == "visited")
386 return featureSet.hasSelectorForVisited(); 386 return featureSet.hasSelectorForVisited();
387 387
388 ASSERT_NOT_REACHED(); 388 ASSERT_NOT_REACHED();
389 return false; 389 return false;
390 } 390 }
391 391
392 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& es) const 392 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& es) const
393 { 393 {
394 if (!node1 || !node2) { 394 if (!node1 || !node2) {
395 es.throwDOMException(InvalidAccessError); 395 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
396 return 0; 396 return 0;
397 } 397 }
398 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) : 398 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) :
399 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0; 399 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0;
400 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) : 400 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) :
401 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0; 401 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0;
402 if (!treeScope1 || !treeScope2) { 402 if (!treeScope1 || !treeScope2) {
403 es.throwDOMException(InvalidAccessError); 403 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
404 return 0; 404 return 0;
405 } 405 }
406 return treeScope1->comparePosition(*treeScope2); 406 return treeScope1->comparePosition(*treeScope2);
407 } 407 }
408 408
409 unsigned Internals::numberOfActiveAnimations() const 409 unsigned Internals::numberOfActiveAnimations() const
410 { 410 {
411 Frame* contextFrame = frame(); 411 Frame* contextFrame = frame();
412 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 412 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
413 return frame()->document()->timeline()->numberOfActiveAnimationsForTesti ng(); 413 return frame()->document()->timeline()->numberOfActiveAnimationsForTesti ng();
414 if (AnimationController* controller = contextFrame->animation()) 414 if (AnimationController* controller = contextFrame->animation())
415 return controller->numberOfActiveAnimations(contextFrame->document()); 415 return controller->numberOfActiveAnimations(contextFrame->document());
416 return 0; 416 return 0;
417 } 417 }
418 418
419 void Internals::suspendAnimations(Document* document, ExceptionState& es) const 419 void Internals::suspendAnimations(Document* document, ExceptionState& es) const
420 { 420 {
421 if (!document || !document->frame()) { 421 if (!document || !document->frame()) {
422 es.throwDOMException(InvalidAccessError); 422 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
423 return; 423 return;
424 } 424 }
425 425
426 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 426 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
427 AnimationController* controller = document->frame()->animation(); 427 AnimationController* controller = document->frame()->animation();
428 if (!controller) 428 if (!controller)
429 return; 429 return;
430 430
431 controller->suspendAnimations(); 431 controller->suspendAnimations();
432 } 432 }
433 } 433 }
434 434
435 void Internals::resumeAnimations(Document* document, ExceptionState& es) const 435 void Internals::resumeAnimations(Document* document, ExceptionState& es) const
436 { 436 {
437 if (!document || !document->frame()) { 437 if (!document || !document->frame()) {
438 es.throwDOMException(InvalidAccessError); 438 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
439 return; 439 return;
440 } 440 }
441 441
442 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 442 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
443 AnimationController* controller = document->frame()->animation(); 443 AnimationController* controller = document->frame()->animation();
444 if (!controller) 444 if (!controller)
445 return; 445 return;
446 446
447 controller->resumeAnimations(); 447 controller->resumeAnimations();
448 } 448 }
449 } 449 }
450 450
451 void Internals::pauseAnimations(double pauseTime, ExceptionState& es) 451 void Internals::pauseAnimations(double pauseTime, ExceptionState& es)
452 { 452 {
453 if (pauseTime < 0) { 453 if (pauseTime < 0) {
454 es.throwDOMException(InvalidAccessError); 454 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
455 return; 455 return;
456 } 456 }
457 457
458 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 458 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
459 frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime); 459 frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime);
460 else 460 else
461 frame()->animation()->pauseAnimationsForTesting(pauseTime); 461 frame()->animation()->pauseAnimationsForTesting(pauseTime);
462 } 462 }
463 463
464 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& es) co nst 464 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& es) co nst
465 { 465 {
466 if (root && root->isShadowRoot()) 466 if (root && root->isShadowRoot())
467 return toShadowRoot(root)->containsShadowElements(); 467 return toShadowRoot(root)->containsShadowElements();
468 468
469 es.throwDOMException(InvalidAccessError); 469 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
470 return 0; 470 return 0;
471 } 471 }
472 472
473 bool Internals::hasContentElement(const Node* root, ExceptionState& es) const 473 bool Internals::hasContentElement(const Node* root, ExceptionState& es) const
474 { 474 {
475 if (root && root->isShadowRoot()) 475 if (root && root->isShadowRoot())
476 return toShadowRoot(root)->containsContentElements(); 476 return toShadowRoot(root)->containsContentElements();
477 477
478 es.throwDOMException(InvalidAccessError); 478 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
479 return 0; 479 return 0;
480 } 480 }
481 481
482 size_t Internals::countElementShadow(const Node* root, ExceptionState& es) const 482 size_t Internals::countElementShadow(const Node* root, ExceptionState& es) const
483 { 483 {
484 if (!root || !root->isShadowRoot()) { 484 if (!root || !root->isShadowRoot()) {
485 es.throwDOMException(InvalidAccessError); 485 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
486 return 0; 486 return 0;
487 } 487 }
488 return toShadowRoot(root)->childShadowRootCount(); 488 return toShadowRoot(root)->childShadowRootCount();
489 } 489 }
490 490
491 bool Internals::attached(Node* node, ExceptionState& es) 491 bool Internals::attached(Node* node, ExceptionState& es)
492 { 492 {
493 if (!node) { 493 if (!node) {
494 es.throwDOMException(InvalidAccessError); 494 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
495 return false; 495 return false;
496 } 496 }
497 497
498 return node->attached(); 498 return node->attached();
499 } 499 }
500 500
501 Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& es) 501 Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& es)
502 { 502 {
503 if (!node) { 503 if (!node) {
504 es.throwDOMException(InvalidAccessError); 504 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
505 return 0; 505 return 0;
506 } 506 }
507 ComposedTreeWalker walker(node); 507 ComposedTreeWalker walker(node);
508 walker.nextSibling(); 508 walker.nextSibling();
509 return walker.get(); 509 return walker.get();
510 } 510 }
511 511
512 Node* Internals::firstChildByWalker(Node* node, ExceptionState& es) 512 Node* Internals::firstChildByWalker(Node* node, ExceptionState& es)
513 { 513 {
514 if (!node) { 514 if (!node) {
515 es.throwDOMException(InvalidAccessError); 515 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
516 return 0; 516 return 0;
517 } 517 }
518 ComposedTreeWalker walker(node); 518 ComposedTreeWalker walker(node);
519 walker.firstChild(); 519 walker.firstChild();
520 return walker.get(); 520 return walker.get();
521 } 521 }
522 522
523 Node* Internals::lastChildByWalker(Node* node, ExceptionState& es) 523 Node* Internals::lastChildByWalker(Node* node, ExceptionState& es)
524 { 524 {
525 if (!node) { 525 if (!node) {
526 es.throwDOMException(InvalidAccessError); 526 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
527 return 0; 527 return 0;
528 } 528 }
529 ComposedTreeWalker walker(node); 529 ComposedTreeWalker walker(node);
530 walker.lastChild(); 530 walker.lastChild();
531 return walker.get(); 531 return walker.get();
532 } 532 }
533 533
534 Node* Internals::nextNodeByWalker(Node* node, ExceptionState& es) 534 Node* Internals::nextNodeByWalker(Node* node, ExceptionState& es)
535 { 535 {
536 if (!node) { 536 if (!node) {
537 es.throwDOMException(InvalidAccessError); 537 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
538 return 0; 538 return 0;
539 } 539 }
540 ComposedTreeWalker walker(node); 540 ComposedTreeWalker walker(node);
541 walker.next(); 541 walker.next();
542 return walker.get(); 542 return walker.get();
543 } 543 }
544 544
545 Node* Internals::previousNodeByWalker(Node* node, ExceptionState& es) 545 Node* Internals::previousNodeByWalker(Node* node, ExceptionState& es)
546 { 546 {
547 if (!node) { 547 if (!node) {
548 es.throwDOMException(InvalidAccessError); 548 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
549 return 0; 549 return 0;
550 } 550 }
551 ComposedTreeWalker walker(node); 551 ComposedTreeWalker walker(node);
552 walker.previous(); 552 walker.previous();
553 return walker.get(); 553 return walker.get();
554 } 554 }
555 555
556 String Internals::elementRenderTreeAsText(Element* element, ExceptionState& es) 556 String Internals::elementRenderTreeAsText(Element* element, ExceptionState& es)
557 { 557 {
558 if (!element) { 558 if (!element) {
559 es.throwDOMException(InvalidAccessError); 559 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
560 return String(); 560 return String();
561 } 561 }
562 562
563 String representation = externalRepresentation(element); 563 String representation = externalRepresentation(element);
564 if (representation.isEmpty()) { 564 if (representation.isEmpty()) {
565 es.throwDOMException(InvalidAccessError); 565 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
566 return String(); 566 return String();
567 } 567 }
568 568
569 return representation; 569 return representation;
570 } 570 }
571 571
572 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionSt ate& es) const 572 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionSt ate& es) const
573 { 573 {
574 if (scope && (scope->isElementNode() || scope->isShadowRoot())) 574 if (scope && (scope->isElementNode() || scope->isShadowRoot()))
575 return scope->numberOfScopedHTMLStyleChildren(); 575 return scope->numberOfScopedHTMLStyleChildren();
576 576
577 es.throwDOMException(InvalidAccessError); 577 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
578 return 0; 578 return 0;
579 } 579 }
580 580
581 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited Info(Node* node, ExceptionState& es) const 581 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited Info(Node* node, ExceptionState& es) const
582 { 582 {
583 if (!node) { 583 if (!node) {
584 es.throwDOMException(InvalidAccessError); 584 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
585 return 0; 585 return 0;
586 } 586 }
587 587
588 bool allowVisitedStyle = true; 588 bool allowVisitedStyle = true;
589 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); 589 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle);
590 } 590 }
591 591
592 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& es) 592 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& es)
593 { 593 {
594 if (!host) { 594 if (!host) {
595 es.throwDOMException(InvalidAccessError); 595 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
596 return 0; 596 return 0;
597 } 597 }
598 598
599 if (ElementShadow* shadow = host->shadow()) 599 if (ElementShadow* shadow = host->shadow())
600 return shadow->youngestShadowRoot(); 600 return shadow->youngestShadowRoot();
601 601
602 return host->createShadowRoot(es).get(); 602 return host->createShadowRoot(es).get();
603 } 603 }
604 604
605 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& es) 605 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& es)
606 { 606 {
607 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh adowRoot() or oldestShadowRoot(). 607 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh adowRoot() or oldestShadowRoot().
608 // https://bugs.webkit.org/show_bug.cgi?id=78465 608 // https://bugs.webkit.org/show_bug.cgi?id=78465
609 return youngestShadowRoot(host, es); 609 return youngestShadowRoot(host, es);
610 } 610 }
611 611
612 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionState& es) 612 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionState& es)
613 { 613 {
614 if (!host) { 614 if (!host) {
615 es.throwDOMException(InvalidAccessError); 615 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
616 return 0; 616 return 0;
617 } 617 }
618 618
619 if (ElementShadow* shadow = host->shadow()) 619 if (ElementShadow* shadow = host->shadow())
620 return shadow->youngestShadowRoot(); 620 return shadow->youngestShadowRoot();
621 return 0; 621 return 0;
622 } 622 }
623 623
624 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionState& es) 624 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionState& es)
625 { 625 {
626 if (!host) { 626 if (!host) {
627 es.throwDOMException(InvalidAccessError); 627 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
628 return 0; 628 return 0;
629 } 629 }
630 630
631 if (ElementShadow* shadow = host->shadow()) 631 if (ElementShadow* shadow = host->shadow())
632 return shadow->oldestShadowRoot(); 632 return shadow->oldestShadowRoot();
633 return 0; 633 return 0;
634 } 634 }
635 635
636 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionState& es) 636 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionState& es)
637 { 637 {
638 if (!shadow || !shadow->isShadowRoot()) { 638 if (!shadow || !shadow->isShadowRoot()) {
639 es.throwDOMException(InvalidAccessError); 639 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
640 return 0; 640 return 0;
641 } 641 }
642 642
643 return toShadowRoot(shadow)->youngerShadowRoot(); 643 return toShadowRoot(shadow)->youngerShadowRoot();
644 } 644 }
645 645
646 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& es) 646 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& es)
647 { 647 {
648 if (!shadow || !shadow->isShadowRoot()) { 648 if (!shadow || !shadow->isShadowRoot()) {
649 es.throwDOMException(InvalidAccessError); 649 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
650 return 0; 650 return 0;
651 } 651 }
652 652
653 return toShadowRoot(shadow)->olderShadowRoot(); 653 return toShadowRoot(shadow)->olderShadowRoot();
654 } 654 }
655 655
656 String Internals::shadowRootType(const Node* root, ExceptionState& es) const 656 String Internals::shadowRootType(const Node* root, ExceptionState& es) const
657 { 657 {
658 if (!root || !root->isShadowRoot()) { 658 if (!root || !root->isShadowRoot()) {
659 es.throwDOMException(InvalidAccessError); 659 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
660 return String(); 660 return String();
661 } 661 }
662 662
663 switch (toShadowRoot(root)->type()) { 663 switch (toShadowRoot(root)->type()) {
664 case ShadowRoot::UserAgentShadowRoot: 664 case ShadowRoot::UserAgentShadowRoot:
665 return String("UserAgentShadowRoot"); 665 return String("UserAgentShadowRoot");
666 case ShadowRoot::AuthorShadowRoot: 666 case ShadowRoot::AuthorShadowRoot:
667 return String("AuthorShadowRoot"); 667 return String("AuthorShadowRoot");
668 default: 668 default:
669 ASSERT_NOT_REACHED(); 669 ASSERT_NOT_REACHED();
670 return String("Unknown"); 670 return String("Unknown");
671 } 671 }
672 } 672 }
673 673
674 Element* Internals::includerFor(Node* node, ExceptionState& es) 674 Element* Internals::includerFor(Node* node, ExceptionState& es)
675 { 675 {
676 if (!node) { 676 if (!node) {
677 es.throwDOMException(InvalidAccessError); 677 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
678 return 0; 678 return 0;
679 } 679 }
680 680
681 NodeRenderingTraversal::ParentDetails parentDetails; 681 NodeRenderingTraversal::ParentDetails parentDetails;
682 NodeRenderingTraversal::parent(node, &parentDetails); 682 NodeRenderingTraversal::parent(node, &parentDetails);
683 return parentDetails.insertionPoint(); 683 return parentDetails.insertionPoint();
684 } 684 }
685 685
686 String Internals::shadowPseudoId(Element* element, ExceptionState& es) 686 String Internals::shadowPseudoId(Element* element, ExceptionState& es)
687 { 687 {
688 if (!element) { 688 if (!element) {
689 es.throwDOMException(InvalidAccessError); 689 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
690 return String(); 690 return String();
691 } 691 }
692 692
693 return element->shadowPseudoId().string(); 693 return element->shadowPseudoId().string();
694 } 694 }
695 695
696 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionS tate& es) 696 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionS tate& es)
697 { 697 {
698 if (!element) { 698 if (!element) {
699 es.throwDOMException(InvalidAccessError); 699 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
700 return; 700 return;
701 } 701 }
702 702
703 return element->setPart(id); 703 return element->setPart(id);
704 } 704 }
705 705
706 String Internals::visiblePlaceholder(Element* element) 706 String Internals::visiblePlaceholder(Element* element)
707 { 707 {
708 if (element && isHTMLTextFormControlElement(element)) { 708 if (element && isHTMLTextFormControlElement(element)) {
709 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible()) 709 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible())
710 return toHTMLTextFormControlElement(element)->placeholderElement()-> textContent(); 710 return toHTMLTextFormControlElement(element)->placeholderElement()-> textContent();
711 } 711 }
712 712
713 return String(); 713 return String();
714 } 714 }
715 715
716 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue) 716 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue)
717 { 717 {
718 if (!element->hasTagName(inputTag)) 718 if (!element->hasTagName(inputTag))
719 return; 719 return;
720 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 720 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
721 } 721 }
722 722
723 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 723 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
724 { 724 {
725 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 725 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
726 if (!mainItem) { 726 if (!mainItem) {
727 es.throwDOMException(InvalidAccessError); 727 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
728 return Vector<String>(); 728 return Vector<String>();
729 } 729 }
730 String uniqueName = frame()->tree()->uniqueName(); 730 String uniqueName = frame()->tree()->uniqueName();
731 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) { 731 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
732 es.throwDOMException(InvalidAccessError); 732 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
733 return Vector<String>(); 733 return Vector<String>();
734 } 734 }
735 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState(); 735 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
736 } 736 }
737 737
738 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 738 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
739 { 739 {
740 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 740 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
741 if (!mainItem) { 741 if (!mainItem) {
742 es.throwDOMException(InvalidAccessError); 742 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
743 return; 743 return;
744 } 744 }
745 String uniqueName = frame()->tree()->uniqueName(); 745 String uniqueName = frame()->tree()->uniqueName();
746 if (mainItem->target() == uniqueName) 746 if (mainItem->target() == uniqueName)
747 mainItem->setDocumentState(state); 747 mainItem->setDocumentState(state);
748 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) 748 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
749 subItem->setDocumentState(state); 749 subItem->setDocumentState(state);
750 else 750 else
751 es.throwDOMException(InvalidAccessError); 751 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
752 } 752 }
753 753
754 void Internals::enableMockSpeechSynthesizer() 754 void Internals::enableMockSpeechSynthesizer()
755 { 755 {
756 Document* document = contextDocument(); 756 Document* document = contextDocument();
757 if (!document || !document->domWindow()) 757 if (!document || !document->domWindow())
758 return; 758 return;
759 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum ent->domWindow()); 759 SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(docum ent->domWindow());
760 if (!synthesis) 760 if (!synthesis)
761 return; 761 return;
(...skipping 18 matching lines...) Expand all
780 780
781 PassRefPtr<PagePopupController> Internals::pagePopupController() 781 PassRefPtr<PagePopupController> Internals::pagePopupController()
782 { 782 {
783 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; 783 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
784 } 784 }
785 785
786 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& es) 786 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& es)
787 { 787 {
788 Document* document = contextDocument(); 788 Document* document = contextDocument();
789 if (!document || !document->view()) { 789 if (!document || !document->view()) {
790 es.throwDOMException(InvalidAccessError); 790 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
791 return ClientRect::create(); 791 return ClientRect::create();
792 } 792 }
793 793
794 return ClientRect::create(document->view()->visibleContentRect()); 794 return ClientRect::create(document->view()->visibleContentRect());
795 } 795 }
796 796
797 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& es) 797 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& es)
798 { 798 {
799 Document* document = contextDocument(); 799 Document* document = contextDocument();
800 if (!document || !document->frame()) { 800 if (!document || !document->frame()) {
801 es.throwDOMException(InvalidAccessError); 801 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
802 return ClientRect::create(); 802 return ClientRect::create();
803 } 803 }
804 804
805 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ()); 805 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ());
806 } 806 }
807 807
808 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& es) 808 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& es)
809 { 809 {
810 if (!element) { 810 if (!element) {
811 es.throwDOMException(InvalidAccessError); 811 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
812 return ClientRect::create(); 812 return ClientRect::create();
813 } 813 }
814 814
815 element->document().updateLayoutIgnorePendingStylesheets(); 815 element->document().updateLayoutIgnorePendingStylesheets();
816 RenderObject* renderer = element->renderer(); 816 RenderObject* renderer = element->renderer();
817 if (!renderer) 817 if (!renderer)
818 return ClientRect::create(); 818 return ClientRect::create();
819 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s()); 819 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s());
820 } 820 }
821 821
822 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionState& es) 822 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionState& es)
823 { 823 {
824 if (!document || !document->page()) { 824 if (!document || !document->page()) {
825 es.throwDOMException(InvalidAccessError); 825 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
826 return ClientRectList::create(); 826 return ClientRectList::create();
827 } 827 }
828 828
829 Highlight highlight; 829 Highlight highlight;
830 document->page()->inspectorController().getHighlight(&highlight); 830 document->page()->inspectorController().getHighlight(&highlight);
831 return ClientRectList::create(highlight.quads); 831 return ClientRectList::create(highlight.quads);
832 } 832 }
833 833
834 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& es) 834 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& es)
835 { 835 {
836 if (!node) { 836 if (!node) {
837 es.throwDOMException(InvalidAccessError); 837 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
838 return 0; 838 return 0;
839 } 839 }
840 840
841 DocumentMarker::MarkerTypes markerTypes = 0; 841 DocumentMarker::MarkerTypes markerTypes = 0;
842 if (!markerTypesFrom(markerType, markerTypes)) { 842 if (!markerTypesFrom(markerType, markerTypes)) {
843 es.throwDOMException(SyntaxError); 843 es.throwUninformativeAndGenericDOMException(SyntaxError);
844 return 0; 844 return 0;
845 } 845 }
846 846
847 return node->document().markers()->markersFor(node, markerTypes).size(); 847 return node->document().markers()->markersFor(node, markerTypes).size();
848 } 848 }
849 849
850 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& es) 850 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& es)
851 { 851 {
852 if (!node) { 852 if (!node) {
853 es.throwDOMException(InvalidAccessError); 853 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
854 return 0; 854 return 0;
855 } 855 }
856 856
857 // Only TextMatch markers can be active. 857 // Only TextMatch markers can be active.
858 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 858 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
859 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerType); 859 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerType);
860 860
861 unsigned activeMarkerCount = 0; 861 unsigned activeMarkerCount = 0;
862 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke rs.end(); ++iter) { 862 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke rs.end(); ++iter) {
863 if ((*iter)->activeMatch()) 863 if ((*iter)->activeMatch())
864 activeMarkerCount++; 864 activeMarkerCount++;
865 } 865 }
866 866
867 return activeMarkerCount; 867 return activeMarkerCount;
868 } 868 }
869 869
870 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& es) 870 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& es)
871 { 871 {
872 if (!node) { 872 if (!node) {
873 es.throwDOMException(InvalidAccessError); 873 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
874 return 0; 874 return 0;
875 } 875 }
876 876
877 DocumentMarker::MarkerTypes markerTypes = 0; 877 DocumentMarker::MarkerTypes markerTypes = 0;
878 if (!markerTypesFrom(markerType, markerTypes)) { 878 if (!markerTypesFrom(markerType, markerTypes)) {
879 es.throwDOMException(SyntaxError); 879 es.throwUninformativeAndGenericDOMException(SyntaxError);
880 return 0; 880 return 0;
881 } 881 }
882 882
883 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerTypes); 883 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerTypes);
884 if (markers.size() <= index) 884 if (markers.size() <= index)
885 return 0; 885 return 0;
886 return markers[index]; 886 return markers[index];
887 } 887 }
888 888
889 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Type, unsigned index, ExceptionState& es) 889 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Type, unsigned index, ExceptionState& es)
(...skipping 14 matching lines...) Expand all
904 904
905 void Internals::addTextMatchMarker(const Range* range, bool isActive) 905 void Internals::addTextMatchMarker(const Range* range, bool isActive)
906 { 906 {
907 range->ownerDocument().updateLayoutIgnorePendingStylesheets(); 907 range->ownerDocument().updateLayoutIgnorePendingStylesheets();
908 range->ownerDocument().markers()->addTextMatchMarker(range, isActive); 908 range->ownerDocument().markers()->addTextMatchMarker(range, isActive);
909 } 909 }
910 910
911 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO ffset, bool active, ExceptionState& es) 911 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO ffset, bool active, ExceptionState& es)
912 { 912 {
913 if (!node) { 913 if (!node) {
914 es.throwDOMException(InvalidAccessError); 914 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
915 return; 915 return;
916 } 916 }
917 917
918 node->document().markers()->setMarkersActive(node, startOffset, endOffset, a ctive); 918 node->document().markers()->setMarkersActive(node, startOffset, endOffset, a ctive);
919 } 919 }
920 920
921 void Internals::setScrollViewPosition(Document* document, long x, long y, Except ionState& es) 921 void Internals::setScrollViewPosition(Document* document, long x, long y, Except ionState& es)
922 { 922 {
923 if (!document || !document->view()) { 923 if (!document || !document->view()) {
924 es.throwDOMException(InvalidAccessError); 924 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
925 return; 925 return;
926 } 926 }
927 927
928 FrameView* frameView = document->view(); 928 FrameView* frameView = document->view();
929 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli ngToContentEdge(); 929 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli ngToContentEdge();
930 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); 930 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed();
931 931
932 frameView->setConstrainsScrollingToContentEdge(false); 932 frameView->setConstrainsScrollingToContentEdge(false);
933 frameView->setScrollbarsSuppressed(false); 933 frameView->setScrollbarsSuppressed(false);
934 frameView->setScrollOffsetFromInternals(IntPoint(x, y)); 934 frameView->setScrollOffsetFromInternals(IntPoint(x, y));
935 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 935 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue);
936 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE dgeOldValue); 936 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE dgeOldValue);
937 } 937 }
938 938
939 void Internals::setPagination(Document* document, const String& mode, int gap, i nt pageLength, ExceptionState& es) 939 void Internals::setPagination(Document* document, const String& mode, int gap, i nt pageLength, ExceptionState& es)
940 { 940 {
941 if (!document || !document->page()) { 941 if (!document || !document->page()) {
942 es.throwDOMException(InvalidAccessError); 942 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
943 return; 943 return;
944 } 944 }
945 Page* page = document->page(); 945 Page* page = document->page();
946 946
947 Pagination pagination; 947 Pagination pagination;
948 if (mode == "Unpaginated") 948 if (mode == "Unpaginated")
949 pagination.mode = Pagination::Unpaginated; 949 pagination.mode = Pagination::Unpaginated;
950 else if (mode == "LeftToRightPaginated") 950 else if (mode == "LeftToRightPaginated")
951 pagination.mode = Pagination::LeftToRightPaginated; 951 pagination.mode = Pagination::LeftToRightPaginated;
952 else if (mode == "RightToLeftPaginated") 952 else if (mode == "RightToLeftPaginated")
953 pagination.mode = Pagination::RightToLeftPaginated; 953 pagination.mode = Pagination::RightToLeftPaginated;
954 else if (mode == "TopToBottomPaginated") 954 else if (mode == "TopToBottomPaginated")
955 pagination.mode = Pagination::TopToBottomPaginated; 955 pagination.mode = Pagination::TopToBottomPaginated;
956 else if (mode == "BottomToTopPaginated") 956 else if (mode == "BottomToTopPaginated")
957 pagination.mode = Pagination::BottomToTopPaginated; 957 pagination.mode = Pagination::BottomToTopPaginated;
958 else { 958 else {
959 es.throwDOMException(SyntaxError); 959 es.throwUninformativeAndGenericDOMException(SyntaxError);
960 return; 960 return;
961 } 961 }
962 962
963 pagination.gap = gap; 963 pagination.gap = gap;
964 pagination.pageLength = pageLength; 964 pagination.pageLength = pageLength;
965 page->setPagination(pagination); 965 page->setPagination(pagination);
966 } 966 }
967 967
968 String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& es) 968 String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& es)
969 { 969 {
970 if (!document || !document->page()) { 970 if (!document || !document->page()) {
971 es.throwDOMException(InvalidAccessError); 971 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
972 return String(); 972 return String();
973 } 973 }
974 Page* page = document->page(); 974 Page* page = document->page();
975 975
976 // Update initial viewport size. 976 // Update initial viewport size.
977 IntSize initialViewportSize(availableWidth, availableHeight); 977 IntSize initialViewportSize(availableWidth, availableHeight);
978 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize)); 978 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize));
979 979
980 ViewportArguments arguments = page->viewportArguments(); 980 ViewportArguments arguments = page->viewportArguments();
981 PageScaleConstraints constraints = arguments.resolve(initialViewportSize); 981 PageScaleConstraints constraints = arguments.resolve(initialViewportSize);
(...skipping 16 matching lines...) Expand all
998 998
999 builder.appendLiteral("] and userScalable "); 999 builder.appendLiteral("] and userScalable ");
1000 builder.append(arguments.userZoom ? "true" : "false"); 1000 builder.append(arguments.userZoom ? "true" : "false");
1001 1001
1002 return builder.toString(); 1002 return builder.toString();
1003 } 1003 }
1004 1004
1005 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionState& es) 1005 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionState& es)
1006 { 1006 {
1007 if (!textField) { 1007 if (!textField) {
1008 es.throwDOMException(InvalidAccessError); 1008 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1009 return false; 1009 return false;
1010 } 1010 }
1011 1011
1012 if (textField->hasTagName(inputTag)) 1012 if (textField->hasTagName(inputTag))
1013 return toHTMLInputElement(textField)->lastChangeWasUserEdit(); 1013 return toHTMLInputElement(textField)->lastChangeWasUserEdit();
1014 1014
1015 // FIXME: We should be using hasTagName instead but Windows port doesn't lin k QualifiedNames properly. 1015 // FIXME: We should be using hasTagName instead but Windows port doesn't lin k QualifiedNames properly.
1016 if (textField->tagName() == "TEXTAREA") 1016 if (textField->tagName() == "TEXTAREA")
1017 return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit(); 1017 return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit();
1018 1018
1019 es.throwDOMException(InvalidNodeTypeError); 1019 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
1020 return false; 1020 return false;
1021 } 1021 }
1022 1022
1023 bool Internals::elementShouldAutoComplete(Element* element, ExceptionState& es) 1023 bool Internals::elementShouldAutoComplete(Element* element, ExceptionState& es)
1024 { 1024 {
1025 if (!element) { 1025 if (!element) {
1026 es.throwDOMException(InvalidAccessError); 1026 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1027 return false; 1027 return false;
1028 } 1028 }
1029 1029
1030 if (element->hasTagName(inputTag)) 1030 if (element->hasTagName(inputTag))
1031 return toHTMLInputElement(element)->shouldAutocomplete(); 1031 return toHTMLInputElement(element)->shouldAutocomplete();
1032 1032
1033 es.throwDOMException(InvalidNodeTypeError); 1033 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
1034 return false; 1034 return false;
1035 } 1035 }
1036 1036
1037 String Internals::suggestedValue(Element* element, ExceptionState& es) 1037 String Internals::suggestedValue(Element* element, ExceptionState& es)
1038 { 1038 {
1039 if (!element) { 1039 if (!element) {
1040 es.throwDOMException(InvalidAccessError); 1040 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1041 return String(); 1041 return String();
1042 } 1042 }
1043 1043
1044 if (!element->hasTagName(inputTag)) { 1044 if (!element->hasTagName(inputTag)) {
1045 es.throwDOMException(InvalidNodeTypeError); 1045 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
1046 return String(); 1046 return String();
1047 } 1047 }
1048 1048
1049 return toHTMLInputElement(element)->suggestedValue(); 1049 return toHTMLInputElement(element)->suggestedValue();
1050 } 1050 }
1051 1051
1052 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& es) 1052 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& es)
1053 { 1053 {
1054 if (!element) { 1054 if (!element) {
1055 es.throwDOMException(InvalidAccessError); 1055 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1056 return; 1056 return;
1057 } 1057 }
1058 1058
1059 if (!element->hasTagName(inputTag)) { 1059 if (!element->hasTagName(inputTag)) {
1060 es.throwDOMException(InvalidNodeTypeError); 1060 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
1061 return; 1061 return;
1062 } 1062 }
1063 1063
1064 toHTMLInputElement(element)->setSuggestedValue(value); 1064 toHTMLInputElement(element)->setSuggestedValue(value);
1065 } 1065 }
1066 1066
1067 void Internals::setEditingValue(Element* element, const String& value, Exception State& es) 1067 void Internals::setEditingValue(Element* element, const String& value, Exception State& es)
1068 { 1068 {
1069 if (!element) { 1069 if (!element) {
1070 es.throwDOMException(InvalidAccessError); 1070 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1071 return; 1071 return;
1072 } 1072 }
1073 1073
1074 if (!element->hasTagName(inputTag)) { 1074 if (!element->hasTagName(inputTag)) {
1075 es.throwDOMException(InvalidNodeTypeError); 1075 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError);
1076 return; 1076 return;
1077 } 1077 }
1078 1078
1079 toHTMLInputElement(element)->setEditingValue(value); 1079 toHTMLInputElement(element)->setEditingValue(value);
1080 } 1080 }
1081 1081
1082 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& es ) 1082 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& es )
1083 { 1083 {
1084 if (!element->hasTagName(inputTag)) { 1084 if (!element->hasTagName(inputTag)) {
1085 es.throwDOMException(InvalidAccessError); 1085 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1086 return; 1086 return;
1087 } 1087 }
1088 toHTMLInputElement(element)->setAutofilled(enabled); 1088 toHTMLInputElement(element)->setAutofilled(enabled);
1089 } 1089 }
1090 1090
1091 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& es) 1091 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& es)
1092 { 1092 {
1093 if (!element || !element->document().view()) { 1093 if (!element || !element->document().view()) {
1094 es.throwDOMException(InvalidAccessError); 1094 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1095 return; 1095 return;
1096 } 1096 }
1097 FrameView* frameView = element->document().view(); 1097 FrameView* frameView = element->document().view();
1098 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); 1098 frameView->scrollElementToRect(element, IntRect(x, y, w, h));
1099 } 1099 }
1100 1100
1101 void Internals::paintControlTints(Document* document, ExceptionState& es) 1101 void Internals::paintControlTints(Document* document, ExceptionState& es)
1102 { 1102 {
1103 if (!document || !document->view()) { 1103 if (!document || !document->view()) {
1104 es.throwDOMException(InvalidAccessError); 1104 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1105 return; 1105 return;
1106 } 1106 }
1107 1107
1108 FrameView* frameView = document->view(); 1108 FrameView* frameView = document->view();
1109 frameView->paintControlTints(); 1109 frameView->paintControlTints();
1110 } 1110 }
1111 1111
1112 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang eLocation, int rangeLength, ExceptionState& es) 1112 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang eLocation, int rangeLength, ExceptionState& es)
1113 { 1113 {
1114 if (!scope) { 1114 if (!scope) {
1115 es.throwDOMException(InvalidAccessError); 1115 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1116 return 0; 1116 return 0;
1117 } 1117 }
1118 1118
1119 // TextIterator depends on Layout information, make sure layout it up to dat e. 1119 // TextIterator depends on Layout information, make sure layout it up to dat e.
1120 scope->document().updateLayoutIgnorePendingStylesheets(); 1120 scope->document().updateLayoutIgnorePendingStylesheets();
1121 1121
1122 return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeL ength); 1122 return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeL ength);
1123 } 1123 }
1124 1124
1125 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except ionState& es) 1125 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except ionState& es)
1126 { 1126 {
1127 if (!scope || !range) { 1127 if (!scope || !range) {
1128 es.throwDOMException(InvalidAccessError); 1128 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1129 return 0; 1129 return 0;
1130 } 1130 }
1131 1131
1132 // TextIterator depends on Layout information, make sure layout it up to dat e. 1132 // TextIterator depends on Layout information, make sure layout it up to dat e.
1133 scope->document().updateLayoutIgnorePendingStylesheets(); 1133 scope->document().updateLayoutIgnorePendingStylesheets();
1134 1134
1135 size_t location = 0; 1135 size_t location = 0;
1136 size_t unusedLength = 0; 1136 size_t unusedLength = 0;
1137 TextIterator::getLocationAndLengthFromRange(scope, range, location, unusedLe ngth); 1137 TextIterator::getLocationAndLengthFromRange(scope, range, location, unusedLe ngth);
1138 return location; 1138 return location;
1139 } 1139 }
1140 1140
1141 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio nState& es) 1141 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio nState& es)
1142 { 1142 {
1143 if (!scope || !range) { 1143 if (!scope || !range) {
1144 es.throwDOMException(InvalidAccessError); 1144 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1145 return 0; 1145 return 0;
1146 } 1146 }
1147 1147
1148 // TextIterator depends on Layout information, make sure layout it up to dat e. 1148 // TextIterator depends on Layout information, make sure layout it up to dat e.
1149 scope->document().updateLayoutIgnorePendingStylesheets(); 1149 scope->document().updateLayoutIgnorePendingStylesheets();
1150 1150
1151 size_t unusedLocation = 0; 1151 size_t unusedLocation = 0;
1152 size_t length = 0; 1152 size_t length = 0;
1153 TextIterator::getLocationAndLengthFromRange(scope, range, unusedLocation, le ngth); 1153 TextIterator::getLocationAndLengthFromRange(scope, range, unusedLocation, le ngth);
1154 return length; 1154 return length;
1155 } 1155 }
1156 1156
1157 String Internals::rangeAsText(const Range* range, ExceptionState& es) 1157 String Internals::rangeAsText(const Range* range, ExceptionState& es)
1158 { 1158 {
1159 if (!range) { 1159 if (!range) {
1160 es.throwDOMException(InvalidAccessError); 1160 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1161 return String(); 1161 return String();
1162 } 1162 }
1163 1163
1164 return range->text(); 1164 return range->text();
1165 } 1165 }
1166 1166
1167 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& es) 1167 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
1168 { 1168 {
1169 if (!document || !document->frame()) { 1169 if (!document || !document->frame()) {
1170 es.throwDOMException(InvalidAccessError); 1170 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1171 return 0; 1171 return 0;
1172 } 1172 }
1173 1173
1174 document->updateLayout(); 1174 document->updateLayout();
1175 1175
1176 IntSize radius(width / 2, height / 2); 1176 IntSize radius(width / 2, height / 2);
1177 IntPoint point(x + radius.width(), y + radius.height()); 1177 IntPoint point(x + radius.width(), y + radius.height());
1178 1178
1179 Node* targetNode; 1179 Node* targetNode;
1180 IntPoint adjustedPoint; 1180 IntPoint adjustedPoint;
1181 1181
1182 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc hPoint(point, radius, adjustedPoint, targetNode); 1182 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc hPoint(point, radius, adjustedPoint, targetNode);
1183 if (foundNode) 1183 if (foundNode)
1184 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1184 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1185 1185
1186 return 0; 1186 return 0;
1187 } 1187 }
1188 1188
1189 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionState& es) 1189 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionState& es)
1190 { 1190 {
1191 if (!document || !document->frame()) { 1191 if (!document || !document->frame()) {
1192 es.throwDOMException(InvalidAccessError); 1192 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1193 return 0; 1193 return 0;
1194 } 1194 }
1195 1195
1196 document->updateLayout(); 1196 document->updateLayout();
1197 1197
1198 IntSize radius(width / 2, height / 2); 1198 IntSize radius(width / 2, height / 2);
1199 IntPoint point(x + radius.width(), y + radius.height()); 1199 IntPoint point(x + radius.width(), y + radius.height());
1200 1200
1201 Node* targetNode; 1201 Node* targetNode;
1202 IntPoint adjustedPoint; 1202 IntPoint adjustedPoint;
1203 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad ius, adjustedPoint, targetNode); 1203 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad ius, adjustedPoint, targetNode);
1204 return targetNode; 1204 return targetNode;
1205 } 1205 }
1206 1206
1207 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& es) 1207 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
1208 { 1208 {
1209 if (!document || !document->frame()) { 1209 if (!document || !document->frame()) {
1210 es.throwDOMException(InvalidAccessError); 1210 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1211 return 0; 1211 return 0;
1212 } 1212 }
1213 1213
1214 document->updateLayout(); 1214 document->updateLayout();
1215 1215
1216 IntSize radius(width / 2, height / 2); 1216 IntSize radius(width / 2, height / 2);
1217 IntPoint point(x + radius.width(), y + radius.height()); 1217 IntPoint point(x + radius.width(), y + radius.height());
1218 1218
1219 Node* targetNode = 0; 1219 Node* targetNode = 0;
1220 IntPoint adjustedPoint; 1220 IntPoint adjustedPoint;
1221 1221
1222 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo uchPoint(point, radius, adjustedPoint, targetNode); 1222 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo uchPoint(point, radius, adjustedPoint, targetNode);
1223 if (foundNode) 1223 if (foundNode)
1224 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1224 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1225 1225
1226 return DOMPoint::create(x, y); 1226 return DOMPoint::create(x, y);
1227 } 1227 }
1228 1228
1229 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionState& es) 1229 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionState& es)
1230 { 1230 {
1231 if (!document || !document->frame()) { 1231 if (!document || !document->frame()) {
1232 es.throwDOMException(InvalidAccessError); 1232 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1233 return 0; 1233 return 0;
1234 } 1234 }
1235 1235
1236 document->updateLayout(); 1236 document->updateLayout();
1237 1237
1238 IntSize radius(width / 2, height / 2); 1238 IntSize radius(width / 2, height / 2);
1239 IntPoint point(x + radius.width(), y + radius.height()); 1239 IntPoint point(x + radius.width(), y + radius.height());
1240 1240
1241 Node* targetNode = 0; 1241 Node* targetNode = 0;
1242 IntPoint adjustedPoint; 1242 IntPoint adjustedPoint;
1243 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r adius, adjustedPoint, targetNode); 1243 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r adius, adjustedPoint, targetNode);
1244 return targetNode; 1244 return targetNode;
1245 } 1245 }
1246 1246
1247 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& es) 1247 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& es)
1248 { 1248 {
1249 if (!document || !document->frame()) { 1249 if (!document || !document->frame()) {
1250 es.throwDOMException(InvalidAccessError); 1250 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1251 return 0; 1251 return 0;
1252 } 1252 }
1253 1253
1254 document->updateLayout(); 1254 document->updateLayout();
1255 1255
1256 IntSize radius(width / 2, height / 2); 1256 IntSize radius(width / 2, height / 2);
1257 IntPoint point(x + radius.width(), y + radius.height()); 1257 IntPoint point(x + radius.width(), y + radius.height());
1258 1258
1259 Node* targetNode; 1259 Node* targetNode;
1260 IntRect zoomableArea; 1260 IntRect zoomableArea;
1261 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch Point(point, radius, zoomableArea, targetNode); 1261 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch Point(point, radius, zoomableArea, targetNode);
1262 if (foundNode) 1262 if (foundNode)
1263 return ClientRect::create(zoomableArea); 1263 return ClientRect::create(zoomableArea);
1264 1264
1265 return 0; 1265 return 0;
1266 } 1266 }
1267 1267
1268 1268
1269 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState& es) 1269 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState& es)
1270 { 1270 {
1271 SpellCheckRequester* requester = spellCheckRequester(document); 1271 SpellCheckRequester* requester = spellCheckRequester(document);
1272 1272
1273 if (!requester) { 1273 if (!requester) {
1274 es.throwDOMException(InvalidAccessError); 1274 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1275 return -1; 1275 return -1;
1276 } 1276 }
1277 1277
1278 return requester->lastRequestSequence(); 1278 return requester->lastRequestSequence();
1279 } 1279 }
1280 1280
1281 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionStat e& es) 1281 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionStat e& es)
1282 { 1282 {
1283 SpellCheckRequester* requester = spellCheckRequester(document); 1283 SpellCheckRequester* requester = spellCheckRequester(document);
1284 1284
1285 if (!requester) { 1285 if (!requester) {
1286 es.throwDOMException(InvalidAccessError); 1286 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1287 return -1; 1287 return -1;
1288 } 1288 }
1289 1289
1290 return requester->lastProcessedSequence(); 1290 return requester->lastProcessedSequence();
1291 } 1291 }
1292 1292
1293 Vector<String> Internals::userPreferredLanguages() const 1293 Vector<String> Internals::userPreferredLanguages() const
1294 { 1294 {
1295 return WebCore::userPreferredLanguages(); 1295 return WebCore::userPreferredLanguages();
1296 } 1296 }
1297 1297
1298 void Internals::setUserPreferredLanguages(const Vector<String>& languages) 1298 void Internals::setUserPreferredLanguages(const Vector<String>& languages)
1299 { 1299 {
1300 WebCore::overrideUserPreferredLanguages(languages); 1300 WebCore::overrideUserPreferredLanguages(languages);
1301 } 1301 }
1302 1302
1303 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e s) 1303 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e s)
1304 { 1304 {
1305 if (!document) { 1305 if (!document) {
1306 es.throwDOMException(InvalidAccessError); 1306 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1307 return 0; 1307 return 0;
1308 } 1308 }
1309 1309
1310 return WheelController::from(document)->wheelEventHandlerCount(); 1310 return WheelController::from(document)->wheelEventHandlerCount();
1311 } 1311 }
1312 1312
1313 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e s) 1313 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e s)
1314 { 1314 {
1315 if (!document) { 1315 if (!document) {
1316 es.throwDOMException(InvalidAccessError); 1316 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1317 return 0; 1317 return 0;
1318 } 1318 }
1319 1319
1320 const TouchEventTargetSet* touchHandlers = TouchController::from(document)-> touchEventTargets(); 1320 const TouchEventTargetSet* touchHandlers = TouchController::from(document)-> touchEventTargets();
1321 if (!touchHandlers) 1321 if (!touchHandlers)
1322 return 0; 1322 return 0;
1323 1323
1324 unsigned count = 0; 1324 unsigned count = 0;
1325 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter != touchHandlers->end(); ++iter) 1325 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter != touchHandlers->end(); ++iter)
1326 count += iter->value; 1326 count += iter->value;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 } 1421 }
1422 1422
1423 size_t numChildren = graphicsLayer->children().size(); 1423 size_t numChildren = graphicsLayer->children().size();
1424 for (size_t i = 0; i < numChildren; ++i) 1424 for (size_t i = 0; i < numChildren; ++i)
1425 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ; 1425 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ;
1426 } 1426 }
1427 1427
1428 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume nt, ExceptionState& es) 1428 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume nt, ExceptionState& es)
1429 { 1429 {
1430 if (!document || !document->view() || !document->page() || document != conte xtDocument()) { 1430 if (!document || !document->view() || !document->page() || document != conte xtDocument()) {
1431 es.throwDOMException(InvalidAccessError); 1431 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1432 return 0; 1432 return 0;
1433 } 1433 }
1434 1434
1435 // Do any pending layouts (which may call touchEventTargetRectsChange) to en sure this 1435 // Do any pending layouts (which may call touchEventTargetRectsChange) to en sure this
1436 // really takes any previous changes into account. 1436 // really takes any previous changes into account.
1437 document->updateLayout(); 1437 document->updateLayout();
1438 1438
1439 if (RenderView* view = document->renderView()) { 1439 if (RenderView* view = document->renderView()) {
1440 if (RenderLayerCompositor* compositor = view->compositor()) { 1440 if (RenderLayerCompositor* compositor = view->compositor()) {
1441 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) { 1441 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) {
1442 RefPtr<LayerRectList> rects = LayerRectList::create(); 1442 RefPtr<LayerRectList> rects = LayerRectList::create();
1443 accumulateLayerRectList(compositor, rootLayer, rects.get()); 1443 accumulateLayerRectList(compositor, rootLayer, rects.get());
1444 return rects; 1444 return rects;
1445 } 1445 }
1446 } 1446 }
1447 } 1447 }
1448 1448
1449 return 0; 1449 return 0;
1450 } 1450 }
1451 1451
1452 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i nt centerY, unsigned topPadding, unsigned rightPadding, 1452 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i nt centerY, unsigned topPadding, unsigned rightPadding,
1453 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo wShadowContent, bool allowChildFrameContent, ExceptionState& es) const 1453 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo wShadowContent, bool allowChildFrameContent, ExceptionState& es) const
1454 { 1454 {
1455 if (!document || !document->frame() || !document->frame()->view()) { 1455 if (!document || !document->frame() || !document->frame()->view()) {
1456 es.throwDOMException(InvalidAccessError); 1456 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1457 return 0; 1457 return 0;
1458 } 1458 }
1459 1459
1460 Frame* frame = document->frame(); 1460 Frame* frame = document->frame();
1461 FrameView* frameView = document->view(); 1461 FrameView* frameView = document->view();
1462 RenderView* renderView = document->renderView(); 1462 RenderView* renderView = document->renderView();
1463 1463
1464 if (!renderView) 1464 if (!renderView)
1465 return 0; 1465 return 0;
1466 1466
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 result.append(memoryCache()->maxDeadCapacity()); 1619 result.append(memoryCache()->maxDeadCapacity());
1620 result.append(memoryCache()->capacity()); 1620 result.append(memoryCache()->capacity());
1621 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes); 1621 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes);
1622 return result; 1622 return result;
1623 } 1623 }
1624 1624
1625 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS ize, int maximumSingleResourceContentSize, ExceptionState& es) 1625 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS ize, int maximumSingleResourceContentSize, ExceptionState& es)
1626 { 1626 {
1627 Page* page = contextDocument()->frame()->page(); 1627 Page* page = contextDocument()->frame()->page();
1628 if (!page) { 1628 if (!page) {
1629 es.throwDOMException(InvalidAccessError); 1629 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1630 return; 1630 return;
1631 } 1631 }
1632 page->inspectorController().setResourcesDataSizeLimitsFromInternals(maximumR esourcesContentSize, maximumSingleResourceContentSize); 1632 page->inspectorController().setResourcesDataSizeLimitsFromInternals(maximumR esourcesContentSize, maximumSingleResourceContentSize);
1633 } 1633 }
1634 1634
1635 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionState&) 1635 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionState&)
1636 { 1636 {
1637 if (!document || !document->frame()) 1637 if (!document || !document->frame())
1638 return 0; 1638 return 0;
1639 1639
(...skipping 11 matching lines...) Expand all
1651 if (child->view() && child->view()->scrollableAreas()) 1651 if (child->view() && child->view()->scrollableAreas())
1652 count += child->view()->scrollableAreas()->size(); 1652 count += child->view()->scrollableAreas()->size();
1653 } 1653 }
1654 1654
1655 return count; 1655 return count;
1656 } 1656 }
1657 1657
1658 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& es) 1658 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& es)
1659 { 1659 {
1660 if (!document) { 1660 if (!document) {
1661 es.throwDOMException(InvalidAccessError); 1661 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1662 return false; 1662 return false;
1663 } 1663 }
1664 1664
1665 return document->isPageBoxVisible(pageNumber); 1665 return document->isPageBoxVisible(pageNumber);
1666 } 1666 }
1667 1667
1668 String Internals::layerTreeAsText(Document* document, ExceptionState& es) const 1668 String Internals::layerTreeAsText(Document* document, ExceptionState& es) const
1669 { 1669 {
1670 return layerTreeAsText(document, 0, es); 1670 return layerTreeAsText(document, 0, es);
1671 } 1671 }
1672 1672
1673 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& es) c onst 1673 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& es) c onst
1674 { 1674 {
1675 return elementLayerTreeAsText(element, 0, es); 1675 return elementLayerTreeAsText(element, 0, es);
1676 } 1676 }
1677 1677
1678 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& es, RenderLayer::PaintOrderListType type) 1678 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& es, RenderLayer::PaintOrderListType type)
1679 { 1679 {
1680 if (!element) { 1680 if (!element) {
1681 es.throwDOMException(InvalidAccessError); 1681 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1682 return 0; 1682 return 0;
1683 } 1683 }
1684 1684
1685 element->document().updateLayout(); 1685 element->document().updateLayout();
1686 1686
1687 RenderObject* renderer = element->renderer(); 1687 RenderObject* renderer = element->renderer();
1688 if (!renderer || !renderer->isBox()) { 1688 if (!renderer || !renderer->isBox()) {
1689 es.throwDOMException(InvalidAccessError); 1689 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1690 return 0; 1690 return 0;
1691 } 1691 }
1692 1692
1693 RenderLayer* layer = toRenderBox(renderer)->layer(); 1693 RenderLayer* layer = toRenderBox(renderer)->layer();
1694 if (!layer) { 1694 if (!layer) {
1695 es.throwDOMException(InvalidAccessError); 1695 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1696 return 0; 1696 return 0;
1697 } 1697 }
1698 1698
1699 Vector<RefPtr<Node> > nodes; 1699 Vector<RefPtr<Node> > nodes;
1700 layer->computePaintOrderList(type, nodes); 1700 layer->computePaintOrderList(type, nodes);
1701 return StaticNodeList::adopt(nodes); 1701 return StaticNodeList::adopt(nodes);
1702 } 1702 }
1703 1703
1704 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex ceptionState& es) 1704 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex ceptionState& es)
1705 { 1705 {
1706 return paintOrderList(element, es, RenderLayer::BeforePromote); 1706 return paintOrderList(element, es, RenderLayer::BeforePromote);
1707 } 1707 }
1708 1708
1709 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc eptionState& es) 1709 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc eptionState& es)
1710 { 1710 {
1711 return paintOrderList(element, es, RenderLayer::AfterPromote); 1711 return paintOrderList(element, es, RenderLayer::AfterPromote);
1712 } 1712 }
1713 1713
1714 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& es) 1714 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& es)
1715 { 1715 {
1716 if (!element1 || !element2) { 1716 if (!element1 || !element2) {
1717 es.throwDOMException(InvalidAccessError); 1717 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1718 return 0; 1718 return 0;
1719 } 1719 }
1720 1720
1721 element1->document().updateLayout(); 1721 element1->document().updateLayout();
1722 1722
1723 RenderObject* renderer1 = element1->renderer(); 1723 RenderObject* renderer1 = element1->renderer();
1724 RenderObject* renderer2 = element2->renderer(); 1724 RenderObject* renderer2 = element2->renderer();
1725 if (!renderer1 || !renderer2 || !renderer1->isBox() || !renderer2->isBox()) { 1725 if (!renderer1 || !renderer2 || !renderer1->isBox() || !renderer2->isBox()) {
1726 es.throwDOMException(InvalidAccessError); 1726 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1727 return 0; 1727 return 0;
1728 } 1728 }
1729 1729
1730 RenderLayer* layer1 = toRenderBox(renderer1)->layer(); 1730 RenderLayer* layer1 = toRenderBox(renderer1)->layer();
1731 RenderLayer* layer2 = toRenderBox(renderer2)->layer(); 1731 RenderLayer* layer2 = toRenderBox(renderer2)->layer();
1732 if (!layer1 || !layer2) { 1732 if (!layer1 || !layer2) {
1733 es.throwDOMException(InvalidAccessError); 1733 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1734 return 0; 1734 return 0;
1735 } 1735 }
1736 1736
1737 return layer1->scrollsWithRespectTo(layer2); 1737 return layer1->scrollsWithRespectTo(layer2);
1738 } 1738 }
1739 1739
1740 bool Internals::isUnclippedDescendant(Element* element, ExceptionState& es) 1740 bool Internals::isUnclippedDescendant(Element* element, ExceptionState& es)
1741 { 1741 {
1742 if (!element) { 1742 if (!element) {
1743 es.throwDOMException(InvalidAccessError); 1743 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1744 return 0; 1744 return 0;
1745 } 1745 }
1746 1746
1747 element->document().updateLayout(); 1747 element->document().updateLayout();
1748 1748
1749 RenderObject* renderer = element->renderer(); 1749 RenderObject* renderer = element->renderer();
1750 if (!renderer || !renderer->isBox()) { 1750 if (!renderer || !renderer->isBox()) {
1751 es.throwDOMException(InvalidAccessError); 1751 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1752 return 0; 1752 return 0;
1753 } 1753 }
1754 1754
1755 RenderLayer* layer = toRenderBox(renderer)->layer(); 1755 RenderLayer* layer = toRenderBox(renderer)->layer();
1756 if (!layer) { 1756 if (!layer) {
1757 es.throwDOMException(InvalidAccessError); 1757 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1758 return 0; 1758 return 0;
1759 } 1759 }
1760 1760
1761 return layer->isUnclippedDescendant(); 1761 return layer->isUnclippedDescendant();
1762 } 1762 }
1763 1763
1764 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& es) const 1764 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& es) const
1765 { 1765 {
1766 if (!document || !document->frame()) { 1766 if (!document || !document->frame()) {
1767 es.throwDOMException(InvalidAccessError); 1767 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1768 return String(); 1768 return String();
1769 } 1769 }
1770 1770
1771 return document->frame()->layerTreeAsText(flags); 1771 return document->frame()->layerTreeAsText(flags);
1772 } 1772 }
1773 1773
1774 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& es) const 1774 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& es) const
1775 { 1775 {
1776 if (!element) { 1776 if (!element) {
1777 es.throwDOMException(InvalidAccessError); 1777 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1778 return String(); 1778 return String();
1779 } 1779 }
1780 1780
1781 element->document().updateLayout(); 1781 element->document().updateLayout();
1782 1782
1783 RenderObject* renderer = element->renderer(); 1783 RenderObject* renderer = element->renderer();
1784 if (!renderer || !renderer->isBox()) { 1784 if (!renderer || !renderer->isBox()) {
1785 es.throwDOMException(InvalidAccessError); 1785 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1786 return String(); 1786 return String();
1787 } 1787 }
1788 1788
1789 RenderLayer* layer = toRenderBox(renderer)->layer(); 1789 RenderLayer* layer = toRenderBox(renderer)->layer();
1790 if (!layer 1790 if (!layer
1791 || !layer->backing() 1791 || !layer->backing()
1792 || !layer->backing()->graphicsLayer()) { 1792 || !layer->backing()->graphicsLayer()) {
1793 // Don't raise exception in these cases which may be normally used in te sts. 1793 // Don't raise exception in these cases which may be normally used in te sts.
1794 return String(); 1794 return String();
1795 } 1795 }
1796 1796
1797 return layer->backing()->graphicsLayer()->layerTreeAsText(flags); 1797 return layer->backing()->graphicsLayer()->layerTreeAsText(flags);
1798 } 1798 }
1799 1799
1800 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& e s) 1800 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& e s)
1801 { 1801 {
1802 if (!element) { 1802 if (!element) {
1803 es.throwDOMException(InvalidAccessError); 1803 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1804 return 0; 1804 return 0;
1805 } 1805 }
1806 1806
1807 RenderObject* renderer = element->renderer(); 1807 RenderObject* renderer = element->renderer();
1808 if (!renderer || !renderer->isBox()) { 1808 if (!renderer || !renderer->isBox()) {
1809 es.throwDOMException(InvalidAccessError); 1809 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1810 return 0; 1810 return 0;
1811 } 1811 }
1812 1812
1813 RenderLayer* layer = toRenderBox(renderer)->layer(); 1813 RenderLayer* layer = toRenderBox(renderer)->layer();
1814 if (!layer) { 1814 if (!layer) {
1815 es.throwDOMException(InvalidAccessError); 1815 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1816 return 0; 1816 return 0;
1817 } 1817 }
1818 1818
1819 return layer; 1819 return layer;
1820 } 1820 }
1821 1821
1822 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp ositedScrolling, ExceptionState& es) 1822 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp ositedScrolling, ExceptionState& es)
1823 { 1823 {
1824 if (!element) { 1824 if (!element) {
1825 es.throwDOMException(InvalidAccessError); 1825 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1826 return; 1826 return;
1827 } 1827 }
1828 1828
1829 element->document().updateLayout(); 1829 element->document().updateLayout();
1830 1830
1831 if (RenderLayer* layer = getRenderLayerForElement(element, es)) 1831 if (RenderLayer* layer = getRenderLayerForElement(element, es))
1832 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNe edsCompositedScrollingMode>(needsCompositedScrolling)); 1832 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNe edsCompositedScrollingMode>(needsCompositedScrolling));
1833 } 1833 }
1834 1834
1835 String Internals::repaintRectsAsText(Document* document, ExceptionState& es) con st 1835 String Internals::repaintRectsAsText(Document* document, ExceptionState& es) con st
1836 { 1836 {
1837 if (!document || !document->frame()) { 1837 if (!document || !document->frame()) {
1838 es.throwDOMException(InvalidAccessError); 1838 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1839 return String(); 1839 return String();
1840 } 1840 }
1841 1841
1842 return document->frame()->trackedRepaintRectsAsText(); 1842 return document->frame()->trackedRepaintRectsAsText();
1843 } 1843 }
1844 1844
1845 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e s) const 1845 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e s) const
1846 { 1846 {
1847 return String(); 1847 return String();
1848 } 1848 }
1849 1849
1850 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& es) const 1850 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& es) const
1851 { 1851 {
1852 if (!document || !document->frame()) { 1852 if (!document || !document->frame()) {
1853 es.throwDOMException(InvalidAccessError); 1853 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1854 return String(); 1854 return String();
1855 } 1855 }
1856 1856
1857 Page* page = document->page(); 1857 Page* page = document->page();
1858 if (!page) 1858 if (!page)
1859 return String(); 1859 return String();
1860 1860
1861 return page->mainThreadScrollingReasonsAsText(); 1861 return page->mainThreadScrollingReasonsAsText();
1862 } 1862 }
1863 1863
1864 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& es) const 1864 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& es) const
1865 { 1865 {
1866 if (!document || !document->frame()) { 1866 if (!document || !document->frame()) {
1867 es.throwDOMException(InvalidAccessError); 1867 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1868 return 0; 1868 return 0;
1869 } 1869 }
1870 1870
1871 Page* page = document->page(); 1871 Page* page = document->page();
1872 if (!page) 1872 if (!page)
1873 return 0; 1873 return 0;
1874 1874
1875 return page->nonFastScrollableRects(document->frame()); 1875 return page->nonFastScrollableRects(document->frame());
1876 } 1876 }
1877 1877
1878 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta te& es) const 1878 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta te& es) const
1879 { 1879 {
1880 if (!document) { 1880 if (!document) {
1881 es.throwDOMException(InvalidAccessError); 1881 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1882 return; 1882 return;
1883 } 1883 }
1884 1884
1885 if (StyleResolver* resolver = contextDocument()->styleResolverIfExists()) 1885 if (StyleResolver* resolver = contextDocument()->styleResolverIfExists())
1886 resolver->clearStyleSharingList(); 1886 resolver->clearStyleSharingList();
1887 if (StyleResolver* resolver = document->styleResolverIfExists()) 1887 if (StyleResolver* resolver = document->styleResolverIfExists())
1888 resolver->clearStyleSharingList(); 1888 resolver->clearStyleSharingList();
1889 1889
1890 ResourceFetcher* fetcher = document->fetcher(); 1890 ResourceFetcher* fetcher = document->fetcher();
1891 if (!fetcher) 1891 if (!fetcher)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 { 1967 {
1968 if (!frame()) 1968 if (!frame())
1969 return -1; 1969 return -1;
1970 1970
1971 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight) ); 1971 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight) );
1972 } 1972 }
1973 1973
1974 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta te& es) const 1974 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta te& es) const
1975 { 1975 {
1976 if (!frame()) { 1976 if (!frame()) {
1977 es.throwDOMException(InvalidAccessError); 1977 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1978 return String(); 1978 return String();
1979 } 1979 }
1980 1980
1981 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN umber); 1981 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN umber);
1982 } 1982 }
1983 1983
1984 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& es) const 1984 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& es) const
1985 { 1985 {
1986 if (!frame()) { 1986 if (!frame()) {
1987 es.throwDOMException(InvalidAccessError); 1987 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1988 return String(); 1988 return String();
1989 } 1989 }
1990 1990
1991 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); 1991 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
1992 } 1992 }
1993 1993
1994 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionState& es) 1994 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionState& es)
1995 { 1995 {
1996 Document* document = contextDocument(); 1996 Document* document = contextDocument();
1997 if (!document || !document->page()) { 1997 if (!document || !document->page()) {
1998 es.throwDOMException(InvalidAccessError); 1998 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
1999 return; 1999 return;
2000 } 2000 }
2001 Page* page = document->page(); 2001 Page* page = document->page();
2002 page->setDeviceScaleFactor(scaleFactor); 2002 page->setDeviceScaleFactor(scaleFactor);
2003 } 2003 }
2004 2004
2005 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception State& es) 2005 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception State& es)
2006 { 2006 {
2007 if (!document || !document->page()) { 2007 if (!document || !document->page()) {
2008 es.throwDOMException(InvalidAccessError); 2008 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2009 return; 2009 return;
2010 } 2010 }
2011 document->page()->setIsCursorVisible(isVisible); 2011 document->page()->setIsCursorVisible(isVisible);
2012 } 2012 }
2013 2013
2014 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element) 2014 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element)
2015 { 2015 {
2016 if (!document) 2016 if (!document)
2017 return; 2017 return;
2018 FullscreenElementStack::from(document)->webkitWillEnterFullScreenForElement( element); 2018 FullscreenElementStack::from(document)->webkitWillEnterFullScreenForElement( element);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 2061
2062 Vector<String> Internals::getReferencedFilePaths() const 2062 Vector<String> Internals::getReferencedFilePaths() const
2063 { 2063 {
2064 frame()->loader()->history()->saveDocumentAndScrollState(); 2064 frame()->loader()->history()->saveDocumentAndScrollState();
2065 return FormController::getReferencedFilePaths(frame()->loader()->history()-> currentItem()->documentState()); 2065 return FormController::getReferencedFilePaths(frame()->loader()->history()-> currentItem()->documentState());
2066 } 2066 }
2067 2067
2068 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2068 void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
2069 { 2069 {
2070 if (!document || !document->view()) { 2070 if (!document || !document->view()) {
2071 es.throwDOMException(InvalidAccessError); 2071 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2072 return; 2072 return;
2073 } 2073 }
2074 2074
2075 FrameView* frameView = document->view(); 2075 FrameView* frameView = document->view();
2076 frameView->setTracksRepaints(true); 2076 frameView->setTracksRepaints(true);
2077 } 2077 }
2078 2078
2079 void Internals::stopTrackingRepaints(Document* document, ExceptionState& es) 2079 void Internals::stopTrackingRepaints(Document* document, ExceptionState& es)
2080 { 2080 {
2081 if (!document || !document->view()) { 2081 if (!document || !document->view()) {
2082 es.throwDOMException(InvalidAccessError); 2082 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2083 return; 2083 return;
2084 } 2084 }
2085 2085
2086 FrameView* frameView = document->view(); 2086 FrameView* frameView = document->view();
2087 frameView->setTracksRepaints(false); 2087 frameView->setTracksRepaints(false);
2088 } 2088 }
2089 2089
2090 static const char* cursorTypeToString(Cursor::Type cursorType) 2090 static const char* cursorTypeToString(Cursor::Type cursorType)
2091 { 2091 {
2092 switch (cursorType) { 2092 switch (cursorType) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 case Cursor::Custom: return "Custom"; 2136 case Cursor::Custom: return "Custom";
2137 } 2137 }
2138 2138
2139 ASSERT_NOT_REACHED(); 2139 ASSERT_NOT_REACHED();
2140 return "UNKNOWN"; 2140 return "UNKNOWN";
2141 } 2141 }
2142 2142
2143 String Internals::getCurrentCursorInfo(Document* document, ExceptionState& es) 2143 String Internals::getCurrentCursorInfo(Document* document, ExceptionState& es)
2144 { 2144 {
2145 if (!document || !document->frame()) { 2145 if (!document || !document->frame()) {
2146 es.throwDOMException(InvalidAccessError); 2146 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2147 return String(); 2147 return String();
2148 } 2148 }
2149 2149
2150 Cursor cursor = document->frame()->eventHandler()->currentMouseCursor(); 2150 Cursor cursor = document->frame()->eventHandler()->currentMouseCursor();
2151 2151
2152 StringBuilder result; 2152 StringBuilder result;
2153 result.append("type="); 2153 result.append("type=");
2154 result.append(cursorTypeToString(cursor.type())); 2154 result.append(cursorTypeToString(cursor.type()));
2155 result.append(" hotSpot="); 2155 result.append(" hotSpot=");
2156 result.appendNumber(cursor.hotSpot().x()); 2156 result.appendNumber(cursor.hotSpot().x());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 2188
2189 void Internals::forceReload(bool endToEnd) 2189 void Internals::forceReload(bool endToEnd)
2190 { 2190 {
2191 frame()->loader()->reload(endToEnd ? EndToEndReload : NormalReload); 2191 frame()->loader()->reload(endToEnd ? EndToEndReload : NormalReload);
2192 } 2192 }
2193 2193
2194 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es) 2194 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es)
2195 { 2195 {
2196 Document* document = contextDocument(); 2196 Document* document = contextDocument();
2197 if (!document || !document->frame()) { 2197 if (!document || !document->frame()) {
2198 es.throwDOMException(InvalidAccessError); 2198 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2199 return 0; 2199 return 0;
2200 } 2200 }
2201 2201
2202 return ClientRect::create(document->frame()->selection().bounds()); 2202 return ClientRect::create(document->frame()->selection().bounds());
2203 } 2203 }
2204 2204
2205 String Internals::markerTextForListItem(Element* element, ExceptionState& es) 2205 String Internals::markerTextForListItem(Element* element, ExceptionState& es)
2206 { 2206 {
2207 if (!element) { 2207 if (!element) {
2208 es.throwDOMException(InvalidAccessError); 2208 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2209 return String(); 2209 return String();
2210 } 2210 }
2211 return WebCore::markerTextForListItem(element); 2211 return WebCore::markerTextForListItem(element);
2212 } 2212 }
2213 2213
2214 String Internals::getImageSourceURL(Element* element, ExceptionState& es) 2214 String Internals::getImageSourceURL(Element* element, ExceptionState& es)
2215 { 2215 {
2216 if (!element) { 2216 if (!element) {
2217 es.throwDOMException(InvalidAccessError); 2217 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2218 return String(); 2218 return String();
2219 } 2219 }
2220 return element->imageSourceURL(); 2220 return element->imageSourceURL();
2221 } 2221 }
2222 2222
2223 String Internals::baseURL(Document* document, ExceptionState& es) 2223 String Internals::baseURL(Document* document, ExceptionState& es)
2224 { 2224 {
2225 if (!document) { 2225 if (!document) {
2226 es.throwDOMException(InvalidAccessError); 2226 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
2227 return String(); 2227 return String();
2228 } 2228 }
2229 2229
2230 return document->baseURL().string(); 2230 return document->baseURL().string();
2231 } 2231 }
2232 2232
2233 bool Internals::isSelectPopupVisible(Node* node) 2233 bool Internals::isSelectPopupVisible(Node* node)
2234 { 2234 {
2235 if (!node->hasTagName(HTMLNames::selectTag)) 2235 if (!node->hasTagName(HTMLNames::selectTag))
2236 return false; 2236 return false;
(...skipping 15 matching lines...) Expand all
2252 return false; 2252 return false;
2253 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2253 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2254 // To prevent tests that call loseSharedGraphicsContext3D from being 2254 // To prevent tests that call loseSharedGraphicsContext3D from being
2255 // flaky, we call finish so that the context is guaranteed to be lost 2255 // flaky, we call finish so that the context is guaranteed to be lost
2256 // synchronously (i.e. before returning). 2256 // synchronously (i.e. before returning).
2257 sharedContext->finish(); 2257 sharedContext->finish();
2258 return true; 2258 return true;
2259 } 2259 }
2260 2260
2261 } 2261 }
OLDNEW
« no previous file with comments | « Source/core/testing/InternalSettings.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698