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

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

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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/timing/Performance.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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 v8::Handle<v8::Value> observedValue = scriptValue.v8Value(); 265 v8::Handle<v8::Value> observedValue = scriptValue.v8Value();
266 ASSERT(!observedValue.IsEmpty()); 266 ASSERT(!observedValue.IsEmpty());
267 if (observedValue->IsNull() || observedValue->IsUndefined()) { 267 if (observedValue->IsNull() || observedValue->IsUndefined()) {
268 V8ThrowException::throwTypeError("value to observe is null or undefined" , v8::Isolate::GetCurrent()); 268 V8ThrowException::throwTypeError("value to observe is null or undefined" , v8::Isolate::GetCurrent());
269 return 0; 269 return 0;
270 } 270 }
271 271
272 return GCObservation::create(observedValue); 272 return GCObservation::create(observedValue);
273 } 273 }
274 274
275 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& es) const 275 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& exc eptionState) const
276 { 276 {
277 Document* document = contextDocument(); 277 Document* document = contextDocument();
278 if (!document) { 278 if (!document) {
279 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 279 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
280 return 0; 280 return 0;
281 } 281 }
282 282
283 unsigned beforeCount = document->styleResolverAccessCount(); 283 unsigned beforeCount = document->styleResolverAccessCount();
284 document->updateStyleIfNeeded(); 284 document->updateStyleIfNeeded();
285 return document->styleResolverAccessCount() - beforeCount; 285 return document->styleResolverAccessCount() - beforeCount;
286 } 286 }
287 287
288 bool Internals::isPreloaded(const String& url) 288 bool Internals::isPreloaded(const String& url)
289 { 289 {
(...skipping 16 matching lines...) Expand all
306 306
307 void Internals::setStyleResolverStatsEnabled(bool enabled) 307 void Internals::setStyleResolverStatsEnabled(bool enabled)
308 { 308 {
309 Document* document = contextDocument(); 309 Document* document = contextDocument();
310 if (enabled) 310 if (enabled)
311 document->styleResolver()->enableStats(StyleResolver::ReportSlowStats); 311 document->styleResolver()->enableStats(StyleResolver::ReportSlowStats);
312 else 312 else
313 document->styleResolver()->disableStats(); 313 document->styleResolver()->disableStats();
314 } 314 }
315 315
316 String Internals::styleResolverStatsReport(ExceptionState& es) const 316 String Internals::styleResolverStatsReport(ExceptionState& exceptionState) const
317 { 317 {
318 Document* document = contextDocument(); 318 Document* document = contextDocument();
319 if (!document->styleResolver()->stats()) { 319 if (!document->styleResolver()->stats()) {
320 es.throwDOMException(InvalidStateError, "Style resolver stats not enable d"); 320 exceptionState.throwDOMException(InvalidStateError, "Style resolver stat s not enabled");
321 return String(); 321 return String();
322 } 322 }
323 return document->styleResolver()->stats()->report(); 323 return document->styleResolver()->stats()->report();
324 } 324 }
325 325
326 String Internals::styleResolverStatsTotalsReport(ExceptionState& es) const 326 String Internals::styleResolverStatsTotalsReport(ExceptionState& exceptionState) const
327 { 327 {
328 Document* document = contextDocument(); 328 Document* document = contextDocument();
329 if (!document->styleResolver()->statsTotals()) { 329 if (!document->styleResolver()->statsTotals()) {
330 es.throwDOMException(InvalidStateError, "Style resolver stats not enable d"); 330 exceptionState.throwDOMException(InvalidStateError, "Style resolver stat s not enabled");
331 return String(); 331 return String();
332 } 332 }
333 return document->styleResolver()->statsTotals()->report(); 333 return document->styleResolver()->statsTotals()->report();
334 } 334 }
335 335
336 PassRefPtr<Element> Internals::createContentElement(ExceptionState& es) 336 PassRefPtr<Element> Internals::createContentElement(ExceptionState& exceptionSta te)
337 { 337 {
338 Document* document = contextDocument(); 338 Document* document = contextDocument();
339 if (!document) { 339 if (!document) {
340 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 340 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
341 return 0; 341 return 0;
342 } 342 }
343 343
344 return HTMLContentElement::create(*document); 344 return HTMLContentElement::create(*document);
345 } 345 }
346 346
347 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& es ) 347 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& ex ceptionState)
348 { 348 {
349 if (!insertionPoint || !insertionPoint->isInsertionPoint()) { 349 if (!insertionPoint || !insertionPoint->isInsertionPoint()) {
350 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 350 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
351 return false; 351 return false;
352 } 352 }
353 353
354 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid(); 354 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid();
355 } 355 }
356 356
357 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es) 357 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& exceptionState)
358 { 358 {
359 if (!node) { 359 if (!node) {
360 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 360 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
361 return 0; 361 return 0;
362 } 362 }
363 363
364 return node->treeScope().rootNode(); 364 return node->treeScope().rootNode();
365 } 365 }
366 366
367 Node* Internals::parentTreeScope(Node* node, ExceptionState& es) 367 Node* Internals::parentTreeScope(Node* node, ExceptionState& exceptionState)
368 { 368 {
369 if (!node) { 369 if (!node) {
370 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 370 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
371 return 0; 371 return 0;
372 } 372 }
373 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); 373 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope();
374 return parentTreeScope ? parentTreeScope->rootNode() : 0; 374 return parentTreeScope ? parentTreeScope->rootNode() : 0;
375 } 375 }
376 376
377 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& es) 377 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& exceptionState)
378 { 378 {
379 if (!host || !host->shadow()) { 379 if (!host || !host->shadow()) {
380 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 380 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
381 return 0; 381 return 0;
382 } 382 }
383 383
384 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); 384 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue);
385 } 385 }
386 386
387 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa me, ExceptionState& es) 387 bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa me, ExceptionState& exceptionState)
388 { 388 {
389 if (!host || !host->shadow()) { 389 if (!host || !host->shadow()) {
390 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 390 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
391 return 0; 391 return 0;
392 } 392 }
393 393
394 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam e); 394 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam e);
395 } 395 }
396 396
397 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att ributeName, ExceptionState& es) 397 bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& att ributeName, ExceptionState& exceptionState)
398 { 398 {
399 if (!host || !host->shadow()) { 399 if (!host || !host->shadow()) {
400 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 400 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
401 return 0; 401 return 0;
402 } 402 }
403 403
404 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName); 404 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr ibuteName);
405 } 405 }
406 406
407 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& es) 407 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p seudoClass, ExceptionState& exceptionState)
408 { 408 {
409 if (!host || !host->shadow()) { 409 if (!host || !host->shadow()) {
410 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 410 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
411 return 0; 411 return 0;
412 } 412 }
413 413
414 const SelectRuleFeatureSet& featureSet = host->shadow()->ensureSelectFeature Set(); 414 const SelectRuleFeatureSet& featureSet = host->shadow()->ensureSelectFeature Set();
415 if (pseudoClass == "checked") 415 if (pseudoClass == "checked")
416 return featureSet.hasSelectorForChecked(); 416 return featureSet.hasSelectorForChecked();
417 if (pseudoClass == "enabled") 417 if (pseudoClass == "enabled")
418 return featureSet.hasSelectorForEnabled(); 418 return featureSet.hasSelectorForEnabled();
419 if (pseudoClass == "disabled") 419 if (pseudoClass == "disabled")
420 return featureSet.hasSelectorForDisabled(); 420 return featureSet.hasSelectorForDisabled();
421 if (pseudoClass == "indeterminate") 421 if (pseudoClass == "indeterminate")
422 return featureSet.hasSelectorForIndeterminate(); 422 return featureSet.hasSelectorForIndeterminate();
423 if (pseudoClass == "link") 423 if (pseudoClass == "link")
424 return featureSet.hasSelectorForLink(); 424 return featureSet.hasSelectorForLink();
425 if (pseudoClass == "target") 425 if (pseudoClass == "target")
426 return featureSet.hasSelectorForTarget(); 426 return featureSet.hasSelectorForTarget();
427 if (pseudoClass == "visited") 427 if (pseudoClass == "visited")
428 return featureSet.hasSelectorForVisited(); 428 return featureSet.hasSelectorForVisited();
429 429
430 ASSERT_NOT_REACHED(); 430 ASSERT_NOT_REACHED();
431 return false; 431 return false;
432 } 432 }
433 433
434 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& es) const 434 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node * node2, ExceptionState& exceptionState) const
435 { 435 {
436 if (!node1 || !node2) { 436 if (!node1 || !node2) {
437 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 437 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
438 return 0; 438 return 0;
439 } 439 }
440 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) : 440 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) :
441 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0; 441 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0;
442 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) : 442 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) :
443 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0; 443 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0;
444 if (!treeScope1 || !treeScope2) { 444 if (!treeScope1 || !treeScope2) {
445 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 445 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
446 return 0; 446 return 0;
447 } 447 }
448 return treeScope1->comparePosition(*treeScope2); 448 return treeScope1->comparePosition(*treeScope2);
449 } 449 }
450 450
451 unsigned Internals::numberOfActiveAnimations() const 451 unsigned Internals::numberOfActiveAnimations() const
452 { 452 {
453 Frame* contextFrame = frame(); 453 Frame* contextFrame = frame();
454 Document* document = contextFrame->document(); 454 Document* document = contextFrame->document();
455 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 455 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
456 return document->timeline()->numberOfActiveAnimationsForTesting() + docu ment->transitionTimeline()->numberOfActiveAnimationsForTesting(); 456 return document->timeline()->numberOfActiveAnimationsForTesting() + docu ment->transitionTimeline()->numberOfActiveAnimationsForTesting();
457 return contextFrame->animation().numberOfActiveAnimations(document); 457 return contextFrame->animation().numberOfActiveAnimations(document);
458 } 458 }
459 459
460 void Internals::pauseAnimations(double pauseTime, ExceptionState& es) 460 void Internals::pauseAnimations(double pauseTime, ExceptionState& exceptionState )
461 { 461 {
462 if (pauseTime < 0) { 462 if (pauseTime < 0) {
463 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 463 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
464 return; 464 return;
465 } 465 }
466 466
467 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 467 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
468 frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime); 468 frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime);
469 frame()->document()->transitionTimeline()->pauseAnimationsForTesting(pau seTime); 469 frame()->document()->transitionTimeline()->pauseAnimationsForTesting(pau seTime);
470 } else { 470 } else {
471 frame()->animation().pauseAnimationsForTesting(pauseTime); 471 frame()->animation().pauseAnimationsForTesting(pauseTime);
472 } 472 }
473 } 473 }
474 474
475 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& es) co nst 475 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except ionState) const
476 { 476 {
477 if (root && root->isShadowRoot()) 477 if (root && root->isShadowRoot())
478 return toShadowRoot(root)->containsShadowElements(); 478 return toShadowRoot(root)->containsShadowElements();
479 479
480 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 480 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
481 return 0; 481 return 0;
482 } 482 }
483 483
484 bool Internals::hasContentElement(const Node* root, ExceptionState& es) const 484 bool Internals::hasContentElement(const Node* root, ExceptionState& exceptionSta te) const
485 { 485 {
486 if (root && root->isShadowRoot()) 486 if (root && root->isShadowRoot())
487 return toShadowRoot(root)->containsContentElements(); 487 return toShadowRoot(root)->containsContentElements();
488 488
489 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 489 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
490 return 0; 490 return 0;
491 } 491 }
492 492
493 size_t Internals::countElementShadow(const Node* root, ExceptionState& es) const 493 size_t Internals::countElementShadow(const Node* root, ExceptionState& exception State) const
494 { 494 {
495 if (!root || !root->isShadowRoot()) { 495 if (!root || !root->isShadowRoot()) {
496 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 496 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
497 return 0; 497 return 0;
498 } 498 }
499 return toShadowRoot(root)->childShadowRootCount(); 499 return toShadowRoot(root)->childShadowRootCount();
500 } 500 }
501 501
502 Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& es) 502 Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& exceptionState)
503 { 503 {
504 if (!node) { 504 if (!node) {
505 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 505 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
506 return 0; 506 return 0;
507 } 507 }
508 ComposedTreeWalker walker(node); 508 ComposedTreeWalker walker(node);
509 walker.nextSibling(); 509 walker.nextSibling();
510 return walker.get(); 510 return walker.get();
511 } 511 }
512 512
513 Node* Internals::firstChildByWalker(Node* node, ExceptionState& es) 513 Node* Internals::firstChildByWalker(Node* node, ExceptionState& exceptionState)
514 { 514 {
515 if (!node) { 515 if (!node) {
516 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 516 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
517 return 0; 517 return 0;
518 } 518 }
519 ComposedTreeWalker walker(node); 519 ComposedTreeWalker walker(node);
520 walker.firstChild(); 520 walker.firstChild();
521 return walker.get(); 521 return walker.get();
522 } 522 }
523 523
524 Node* Internals::lastChildByWalker(Node* node, ExceptionState& es) 524 Node* Internals::lastChildByWalker(Node* node, ExceptionState& exceptionState)
525 { 525 {
526 if (!node) { 526 if (!node) {
527 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 527 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
528 return 0; 528 return 0;
529 } 529 }
530 ComposedTreeWalker walker(node); 530 ComposedTreeWalker walker(node);
531 walker.lastChild(); 531 walker.lastChild();
532 return walker.get(); 532 return walker.get();
533 } 533 }
534 534
535 Node* Internals::nextNodeByWalker(Node* node, ExceptionState& es) 535 Node* Internals::nextNodeByWalker(Node* node, ExceptionState& exceptionState)
536 { 536 {
537 if (!node) { 537 if (!node) {
538 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 538 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
539 return 0; 539 return 0;
540 } 540 }
541 ComposedTreeWalker walker(node); 541 ComposedTreeWalker walker(node);
542 walker.next(); 542 walker.next();
543 return walker.get(); 543 return walker.get();
544 } 544 }
545 545
546 Node* Internals::previousNodeByWalker(Node* node, ExceptionState& es) 546 Node* Internals::previousNodeByWalker(Node* node, ExceptionState& exceptionState )
547 { 547 {
548 if (!node) { 548 if (!node) {
549 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 549 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
550 return 0; 550 return 0;
551 } 551 }
552 ComposedTreeWalker walker(node); 552 ComposedTreeWalker walker(node);
553 walker.previous(); 553 walker.previous();
554 return walker.get(); 554 return walker.get();
555 } 555 }
556 556
557 String Internals::elementRenderTreeAsText(Element* element, ExceptionState& es) 557 String Internals::elementRenderTreeAsText(Element* element, ExceptionState& exce ptionState)
558 { 558 {
559 if (!element) { 559 if (!element) {
560 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 560 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
561 return String(); 561 return String();
562 } 562 }
563 563
564 String representation = externalRepresentation(element); 564 String representation = externalRepresentation(element);
565 if (representation.isEmpty()) { 565 if (representation.isEmpty()) {
566 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 566 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
567 return String(); 567 return String();
568 } 568 }
569 569
570 return representation; 570 return representation;
571 } 571 }
572 572
573 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionSt ate& es) const 573 size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionSt ate& exceptionState) const
574 { 574 {
575 if (scope && (scope->isElementNode() || scope->isShadowRoot())) 575 if (scope && (scope->isElementNode() || scope->isShadowRoot()))
576 return scope->numberOfScopedHTMLStyleChildren(); 576 return scope->numberOfScopedHTMLStyleChildren();
577 577
578 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 578 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
579 return 0; 579 return 0;
580 } 580 }
581 581
582 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited Info(Node* node, ExceptionState& es) const 582 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited Info(Node* node, ExceptionState& exceptionState) const
583 { 583 {
584 if (!node) { 584 if (!node) {
585 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 585 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
586 return 0; 586 return 0;
587 } 587 }
588 588
589 bool allowVisitedStyle = true; 589 bool allowVisitedStyle = true;
590 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); 590 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle);
591 } 591 }
592 592
593 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& es) 593 ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& exception State)
594 { 594 {
595 if (!host) { 595 if (!host) {
596 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 596 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
597 return 0; 597 return 0;
598 } 598 }
599 599
600 if (ElementShadow* shadow = host->shadow()) 600 if (ElementShadow* shadow = host->shadow())
601 return shadow->youngestShadowRoot(); 601 return shadow->youngestShadowRoot();
602 602
603 return host->createShadowRoot(es).get(); 603 return host->createShadowRoot(exceptionState).get();
604 } 604 }
605 605
606 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& es) 606 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& exceptionState)
607 { 607 {
608 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh adowRoot() or oldestShadowRoot(). 608 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh adowRoot() or oldestShadowRoot().
609 // https://bugs.webkit.org/show_bug.cgi?id=78465 609 // https://bugs.webkit.org/show_bug.cgi?id=78465
610 return youngestShadowRoot(host, es); 610 return youngestShadowRoot(host, exceptionState);
611 } 611 }
612 612
613 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionState& es) 613 ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionState& excepti onState)
614 { 614 {
615 if (!host) { 615 if (!host) {
616 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 616 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
617 return 0; 617 return 0;
618 } 618 }
619 619
620 if (ElementShadow* shadow = host->shadow()) 620 if (ElementShadow* shadow = host->shadow())
621 return shadow->youngestShadowRoot(); 621 return shadow->youngestShadowRoot();
622 return 0; 622 return 0;
623 } 623 }
624 624
625 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionState& es) 625 ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionState& exception State)
626 { 626 {
627 if (!host) { 627 if (!host) {
628 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 628 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
629 return 0; 629 return 0;
630 } 630 }
631 631
632 if (ElementShadow* shadow = host->shadow()) 632 if (ElementShadow* shadow = host->shadow())
633 return shadow->oldestShadowRoot(); 633 return shadow->oldestShadowRoot();
634 return 0; 634 return 0;
635 } 635 }
636 636
637 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionState& es) 637 ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionState& exception State)
638 { 638 {
639 if (!shadow || !shadow->isShadowRoot()) { 639 if (!shadow || !shadow->isShadowRoot()) {
640 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 640 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
641 return 0; 641 return 0;
642 } 642 }
643 643
644 return toShadowRoot(shadow)->youngerShadowRoot(); 644 return toShadowRoot(shadow)->youngerShadowRoot();
645 } 645 }
646 646
647 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& es) 647 ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& exceptionSt ate)
648 { 648 {
649 if (!shadow || !shadow->isShadowRoot()) { 649 if (!shadow || !shadow->isShadowRoot()) {
650 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 650 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
651 return 0; 651 return 0;
652 } 652 }
653 653
654 return toShadowRoot(shadow)->olderShadowRoot(); 654 return toShadowRoot(shadow)->olderShadowRoot();
655 } 655 }
656 656
657 String Internals::shadowRootType(const Node* root, ExceptionState& es) const 657 String Internals::shadowRootType(const Node* root, ExceptionState& exceptionStat e) const
658 { 658 {
659 if (!root || !root->isShadowRoot()) { 659 if (!root || !root->isShadowRoot()) {
660 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 660 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
661 return String(); 661 return String();
662 } 662 }
663 663
664 switch (toShadowRoot(root)->type()) { 664 switch (toShadowRoot(root)->type()) {
665 case ShadowRoot::UserAgentShadowRoot: 665 case ShadowRoot::UserAgentShadowRoot:
666 return String("UserAgentShadowRoot"); 666 return String("UserAgentShadowRoot");
667 case ShadowRoot::AuthorShadowRoot: 667 case ShadowRoot::AuthorShadowRoot:
668 return String("AuthorShadowRoot"); 668 return String("AuthorShadowRoot");
669 default: 669 default:
670 ASSERT_NOT_REACHED(); 670 ASSERT_NOT_REACHED();
671 return String("Unknown"); 671 return String("Unknown");
672 } 672 }
673 } 673 }
674 674
675 String Internals::shadowPseudoId(Element* element, ExceptionState& es) 675 String Internals::shadowPseudoId(Element* element, ExceptionState& exceptionStat e)
676 { 676 {
677 if (!element) { 677 if (!element) {
678 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 678 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
679 return String(); 679 return String();
680 } 680 }
681 681
682 return element->shadowPseudoId().string(); 682 return element->shadowPseudoId().string();
683 } 683 }
684 684
685 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionS tate& es) 685 void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionS tate& exceptionState)
686 { 686 {
687 if (!element) { 687 if (!element) {
688 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 688 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
689 return; 689 return;
690 } 690 }
691 691
692 return element->setPart(id); 692 return element->setPart(id);
693 } 693 }
694 694
695 String Internals::visiblePlaceholder(Element* element) 695 String Internals::visiblePlaceholder(Element* element)
696 { 696 {
697 if (element && isHTMLTextFormControlElement(element)) { 697 if (element && isHTMLTextFormControlElement(element)) {
698 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible()) 698 if (toHTMLTextFormControlElement(element)->placeholderShouldBeVisible())
699 return toHTMLTextFormControlElement(element)->placeholderElement()-> textContent(); 699 return toHTMLTextFormControlElement(element)->placeholderElement()-> textContent();
700 } 700 }
701 701
702 return String(); 702 return String();
703 } 703 }
704 704
705 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue) 705 void Internals::selectColorInColorChooser(Element* element, const String& colorV alue)
706 { 706 {
707 if (!element->hasTagName(inputTag)) 707 if (!element->hasTagName(inputTag))
708 return; 708 return;
709 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 709 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
710 } 710 }
711 711
712 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 712 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& exceptionState)
713 { 713 {
714 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 714 HistoryItem* mainItem = frame()->loader().history()->previousItem();
715 if (!mainItem) { 715 if (!mainItem) {
716 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 716 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
717 return Vector<String>(); 717 return Vector<String>();
718 } 718 }
719 String uniqueName = frame()->tree().uniqueName(); 719 String uniqueName = frame()->tree().uniqueName();
720 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) { 720 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
721 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 721 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
722 return Vector<String>(); 722 return Vector<String>();
723 } 723 }
724 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState(); 724 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
725 } 725 }
726 726
727 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 727 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& exceptionState)
728 { 728 {
729 HistoryItem* mainItem = frame()->loader().history()->previousItem(); 729 HistoryItem* mainItem = frame()->loader().history()->previousItem();
730 if (!mainItem) { 730 if (!mainItem) {
731 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 731 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
732 return; 732 return;
733 } 733 }
734 String uniqueName = frame()->tree().uniqueName(); 734 String uniqueName = frame()->tree().uniqueName();
735 if (mainItem->target() == uniqueName) 735 if (mainItem->target() == uniqueName)
736 mainItem->setDocumentState(state); 736 mainItem->setDocumentState(state);
737 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) 737 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
738 subItem->setDocumentState(state); 738 subItem->setDocumentState(state);
739 else 739 else
740 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 740 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
741 } 741 }
742 742
743 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es) 743 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& exceptionSt ate)
744 { 744 {
745 Document* document = contextDocument(); 745 Document* document = contextDocument();
746 if (!document || !document->page()) 746 if (!document || !document->page())
747 return; 747 return;
748 Page* page = document->page(); 748 Page* page = document->page();
749 if (!enabled) { 749 if (!enabled) {
750 page->chrome().client().resetPagePopupDriver(); 750 page->chrome().client().resetPagePopupDriver();
751 return; 751 return;
752 } 752 }
753 if (!s_pagePopupDriver) 753 if (!s_pagePopupDriver)
754 s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakP tr(); 754 s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakP tr();
755 page->chrome().client().setPagePopupDriver(s_pagePopupDriver); 755 page->chrome().client().setPagePopupDriver(s_pagePopupDriver);
756 } 756 }
757 757
758 PassRefPtr<PagePopupController> Internals::pagePopupController() 758 PassRefPtr<PagePopupController> Internals::pagePopupController()
759 { 759 {
760 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; 760 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
761 } 761 }
762 762
763 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& es) 763 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& exception State)
764 { 764 {
765 Document* document = contextDocument(); 765 Document* document = contextDocument();
766 if (!document || !document->view()) { 766 if (!document || !document->view()) {
767 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 767 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
768 return ClientRect::create(); 768 return ClientRect::create();
769 } 769 }
770 770
771 return ClientRect::create(document->view()->visibleContentRect()); 771 return ClientRect::create(document->view()->visibleContentRect());
772 } 772 }
773 773
774 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& es) 774 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& exceptionS tate)
775 { 775 {
776 Document* document = contextDocument(); 776 Document* document = contextDocument();
777 if (!document || !document->frame()) { 777 if (!document || !document->frame()) {
778 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 778 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
779 return ClientRect::create(); 779 return ClientRect::create();
780 } 780 }
781 781
782 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ()); 782 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ());
783 } 783 }
784 784
785 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& es) 785 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& exceptionState)
786 { 786 {
787 if (!element) { 787 if (!element) {
788 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 788 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
789 return ClientRect::create(); 789 return ClientRect::create();
790 } 790 }
791 791
792 element->document().updateLayoutIgnorePendingStylesheets(); 792 element->document().updateLayoutIgnorePendingStylesheets();
793 RenderObject* renderer = element->renderer(); 793 RenderObject* renderer = element->renderer();
794 if (!renderer) 794 if (!renderer)
795 return ClientRect::create(); 795 return ClientRect::create();
796 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s()); 796 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s());
797 } 797 }
798 798
799 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionState& es) 799 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionState& exceptionState)
800 { 800 {
801 if (!document || !document->page()) { 801 if (!document || !document->page()) {
802 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 802 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
803 return ClientRectList::create(); 803 return ClientRectList::create();
804 } 804 }
805 805
806 Highlight highlight; 806 Highlight highlight;
807 document->page()->inspectorController().getHighlight(&highlight); 807 document->page()->inspectorController().getHighlight(&highlight);
808 return ClientRectList::create(highlight.quads); 808 return ClientRectList::create(highlight.quads);
809 } 809 }
810 810
811 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& es) 811 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionState& exceptionState)
812 { 812 {
813 if (!node) { 813 if (!node) {
814 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 814 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
815 return 0; 815 return 0;
816 } 816 }
817 817
818 DocumentMarker::MarkerTypes markerTypes = 0; 818 DocumentMarker::MarkerTypes markerTypes = 0;
819 if (!markerTypesFrom(markerType, markerTypes)) { 819 if (!markerTypesFrom(markerType, markerTypes)) {
820 es.throwUninformativeAndGenericDOMException(SyntaxError); 820 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
821 return 0; 821 return 0;
822 } 822 }
823 823
824 return node->document().markers()->markersFor(node, markerTypes).size(); 824 return node->document().markers()->markersFor(node, markerTypes).size();
825 } 825 }
826 826
827 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& es) 827 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& excepti onState)
828 { 828 {
829 if (!node) { 829 if (!node) {
830 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 830 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
831 return 0; 831 return 0;
832 } 832 }
833 833
834 // Only TextMatch markers can be active. 834 // Only TextMatch markers can be active.
835 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 835 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
836 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerType); 836 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerType);
837 837
838 unsigned activeMarkerCount = 0; 838 unsigned activeMarkerCount = 0;
839 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke rs.end(); ++iter) { 839 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke rs.end(); ++iter) {
840 if ((*iter)->activeMatch()) 840 if ((*iter)->activeMatch())
841 activeMarkerCount++; 841 activeMarkerCount++;
842 } 842 }
843 843
844 return activeMarkerCount; 844 return activeMarkerCount;
845 } 845 }
846 846
847 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& es) 847 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState)
848 { 848 {
849 if (!node) { 849 if (!node) {
850 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 850 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
851 return 0; 851 return 0;
852 } 852 }
853 853
854 DocumentMarker::MarkerTypes markerTypes = 0; 854 DocumentMarker::MarkerTypes markerTypes = 0;
855 if (!markerTypesFrom(markerType, markerTypes)) { 855 if (!markerTypesFrom(markerType, markerTypes)) {
856 es.throwUninformativeAndGenericDOMException(SyntaxError); 856 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
857 return 0; 857 return 0;
858 } 858 }
859 859
860 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerTypes); 860 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod e, markerTypes);
861 if (markers.size() <= index) 861 if (markers.size() <= index)
862 return 0; 862 return 0;
863 return markers[index]; 863 return markers[index];
864 } 864 }
865 865
866 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Type, unsigned index, ExceptionState& es) 866 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Type, unsigned index, ExceptionState& exceptionState)
867 { 867 {
868 DocumentMarker* marker = markerAt(node, markerType, index, es); 868 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
869 if (!marker) 869 if (!marker)
870 return 0; 870 return 0;
871 return Range::create(node->document(), node, marker->startOffset(), node, ma rker->endOffset()); 871 return Range::create(node->document(), node, marker->startOffset(), node, ma rker->endOffset());
872 } 872 }
873 873
874 String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionState& es) 874 String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionState& exceptionState)
875 { 875 {
876 DocumentMarker* marker = markerAt(node, markerType, index, es); 876 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
877 if (!marker) 877 if (!marker)
878 return String(); 878 return String();
879 return marker->description(); 879 return marker->description();
880 } 880 }
881 881
882 void Internals::addTextMatchMarker(const Range* range, bool isActive) 882 void Internals::addTextMatchMarker(const Range* range, bool isActive)
883 { 883 {
884 range->ownerDocument().updateLayoutIgnorePendingStylesheets(); 884 range->ownerDocument().updateLayoutIgnorePendingStylesheets();
885 range->ownerDocument().markers()->addTextMatchMarker(range, isActive); 885 range->ownerDocument().markers()->addTextMatchMarker(range, isActive);
886 } 886 }
887 887
888 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO ffset, bool active, ExceptionState& es) 888 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO ffset, bool active, ExceptionState& exceptionState)
889 { 889 {
890 if (!node) { 890 if (!node) {
891 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 891 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
892 return; 892 return;
893 } 893 }
894 894
895 node->document().markers()->setMarkersActive(node, startOffset, endOffset, a ctive); 895 node->document().markers()->setMarkersActive(node, startOffset, endOffset, a ctive);
896 } 896 }
897 897
898 void Internals::setScrollViewPosition(Document* document, long x, long y, Except ionState& es) 898 void Internals::setScrollViewPosition(Document* document, long x, long y, Except ionState& exceptionState)
899 { 899 {
900 if (!document || !document->view()) { 900 if (!document || !document->view()) {
901 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 901 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
902 return; 902 return;
903 } 903 }
904 904
905 FrameView* frameView = document->view(); 905 FrameView* frameView = document->view();
906 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli ngToContentEdge(); 906 bool constrainsScrollingToContentEdgeOldValue = frameView->constrainsScrolli ngToContentEdge();
907 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); 907 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed();
908 908
909 frameView->setConstrainsScrollingToContentEdge(false); 909 frameView->setConstrainsScrollingToContentEdge(false);
910 frameView->setScrollbarsSuppressed(false); 910 frameView->setScrollbarsSuppressed(false);
911 frameView->setScrollOffsetFromInternals(IntPoint(x, y)); 911 frameView->setScrollOffsetFromInternals(IntPoint(x, y));
912 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 912 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue);
913 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE dgeOldValue); 913 frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentE dgeOldValue);
914 } 914 }
915 915
916 void Internals::setPagination(Document* document, const String& mode, int gap, i nt pageLength, ExceptionState& es) 916 void Internals::setPagination(Document* document, const String& mode, int gap, i nt pageLength, ExceptionState& exceptionState)
917 { 917 {
918 if (!document || !document->page()) { 918 if (!document || !document->page()) {
919 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 919 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
920 return; 920 return;
921 } 921 }
922 Page* page = document->page(); 922 Page* page = document->page();
923 923
924 Pagination pagination; 924 Pagination pagination;
925 if (mode == "Unpaginated") 925 if (mode == "Unpaginated")
926 pagination.mode = Pagination::Unpaginated; 926 pagination.mode = Pagination::Unpaginated;
927 else if (mode == "LeftToRightPaginated") 927 else if (mode == "LeftToRightPaginated")
928 pagination.mode = Pagination::LeftToRightPaginated; 928 pagination.mode = Pagination::LeftToRightPaginated;
929 else if (mode == "RightToLeftPaginated") 929 else if (mode == "RightToLeftPaginated")
930 pagination.mode = Pagination::RightToLeftPaginated; 930 pagination.mode = Pagination::RightToLeftPaginated;
931 else if (mode == "TopToBottomPaginated") 931 else if (mode == "TopToBottomPaginated")
932 pagination.mode = Pagination::TopToBottomPaginated; 932 pagination.mode = Pagination::TopToBottomPaginated;
933 else if (mode == "BottomToTopPaginated") 933 else if (mode == "BottomToTopPaginated")
934 pagination.mode = Pagination::BottomToTopPaginated; 934 pagination.mode = Pagination::BottomToTopPaginated;
935 else { 935 else {
936 es.throwUninformativeAndGenericDOMException(SyntaxError); 936 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
937 return; 937 return;
938 } 938 }
939 939
940 pagination.gap = gap; 940 pagination.gap = gap;
941 pagination.pageLength = pageLength; 941 pagination.pageLength = pageLength;
942 page->setPagination(pagination); 942 page->setPagination(pagination);
943 } 943 }
944 944
945 String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& es) 945 String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& exceptionState)
946 { 946 {
947 if (!document || !document->page()) { 947 if (!document || !document->page()) {
948 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 948 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
949 return String(); 949 return String();
950 } 950 }
951 Page* page = document->page(); 951 Page* page = document->page();
952 952
953 // Update initial viewport size. 953 // Update initial viewport size.
954 IntSize initialViewportSize(availableWidth, availableHeight); 954 IntSize initialViewportSize(availableWidth, availableHeight);
955 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize)); 955 document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero() , initialViewportSize));
956 956
957 ViewportDescription description = page->viewportDescription(); 957 ViewportDescription description = page->viewportDescription();
958 PageScaleConstraints constraints = description.resolve(initialViewportSize); 958 PageScaleConstraints constraints = description.resolve(initialViewportSize);
(...skipping 13 matching lines...) Expand all
972 builder.append(String::number(constraints.minimumScale)); 972 builder.append(String::number(constraints.minimumScale));
973 builder.appendLiteral(", "); 973 builder.appendLiteral(", ");
974 builder.append(String::number(constraints.maximumScale)); 974 builder.append(String::number(constraints.maximumScale));
975 975
976 builder.appendLiteral("] and userScalable "); 976 builder.appendLiteral("] and userScalable ");
977 builder.append(description.userZoom ? "true" : "false"); 977 builder.append(description.userZoom ? "true" : "false");
978 978
979 return builder.toString(); 979 return builder.toString();
980 } 980 }
981 981
982 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionState& es) 982 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionState& except ionState)
983 { 983 {
984 if (!textField) { 984 if (!textField) {
985 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 985 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
986 return false; 986 return false;
987 } 987 }
988 988
989 if (textField->hasTagName(inputTag)) 989 if (textField->hasTagName(inputTag))
990 return toHTMLInputElement(textField)->lastChangeWasUserEdit(); 990 return toHTMLInputElement(textField)->lastChangeWasUserEdit();
991 991
992 // FIXME: We should be using hasTagName instead but Windows port doesn't lin k QualifiedNames properly. 992 // FIXME: We should be using hasTagName instead but Windows port doesn't lin k QualifiedNames properly.
993 if (textField->tagName() == "TEXTAREA") 993 if (textField->tagName() == "TEXTAREA")
994 return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit(); 994 return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit();
995 995
996 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); 996 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError );
997 return false; 997 return false;
998 } 998 }
999 999
1000 bool Internals::elementShouldAutoComplete(Element* element, ExceptionState& es) 1000 bool Internals::elementShouldAutoComplete(Element* element, ExceptionState& exce ptionState)
1001 { 1001 {
1002 if (!element) { 1002 if (!element) {
1003 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1003 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1004 return false; 1004 return false;
1005 } 1005 }
1006 1006
1007 if (element->hasTagName(inputTag)) 1007 if (element->hasTagName(inputTag))
1008 return toHTMLInputElement(element)->shouldAutocomplete(); 1008 return toHTMLInputElement(element)->shouldAutocomplete();
1009 1009
1010 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); 1010 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError );
1011 return false; 1011 return false;
1012 } 1012 }
1013 1013
1014 String Internals::suggestedValue(Element* element, ExceptionState& es) 1014 String Internals::suggestedValue(Element* element, ExceptionState& exceptionStat e)
1015 { 1015 {
1016 if (!element) { 1016 if (!element) {
1017 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1017 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1018 return String(); 1018 return String();
1019 } 1019 }
1020 1020
1021 if (!element->hasTagName(inputTag)) { 1021 if (!element->hasTagName(inputTag)) {
1022 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); 1022 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1023 return String(); 1023 return String();
1024 } 1024 }
1025 1025
1026 return toHTMLInputElement(element)->suggestedValue(); 1026 return toHTMLInputElement(element)->suggestedValue();
1027 } 1027 }
1028 1028
1029 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& es) 1029 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState)
1030 { 1030 {
1031 if (!element) { 1031 if (!element) {
1032 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1032 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1033 return; 1033 return;
1034 } 1034 }
1035 1035
1036 if (!element->hasTagName(inputTag)) { 1036 if (!element->hasTagName(inputTag)) {
1037 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); 1037 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1038 return; 1038 return;
1039 } 1039 }
1040 1040
1041 toHTMLInputElement(element)->setSuggestedValue(value); 1041 toHTMLInputElement(element)->setSuggestedValue(value);
1042 } 1042 }
1043 1043
1044 void Internals::setEditingValue(Element* element, const String& value, Exception State& es) 1044 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState)
1045 { 1045 {
1046 if (!element) { 1046 if (!element) {
1047 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1047 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1048 return; 1048 return;
1049 } 1049 }
1050 1050
1051 if (!element->hasTagName(inputTag)) { 1051 if (!element->hasTagName(inputTag)) {
1052 es.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); 1052 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1053 return; 1053 return;
1054 } 1054 }
1055 1055
1056 toHTMLInputElement(element)->setEditingValue(value); 1056 toHTMLInputElement(element)->setEditingValue(value);
1057 } 1057 }
1058 1058
1059 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& es ) 1059 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& ex ceptionState)
1060 { 1060 {
1061 if (!element->isFormControlElement()) { 1061 if (!element->isFormControlElement()) {
1062 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1062 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1063 return; 1063 return;
1064 } 1064 }
1065 toHTMLFormControlElement(element)->setAutofilled(enabled); 1065 toHTMLFormControlElement(element)->setAutofilled(enabled);
1066 } 1066 }
1067 1067
1068 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& es) 1068 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& exceptionState)
1069 { 1069 {
1070 if (!element || !element->document().view()) { 1070 if (!element || !element->document().view()) {
1071 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1071 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1072 return; 1072 return;
1073 } 1073 }
1074 FrameView* frameView = element->document().view(); 1074 FrameView* frameView = element->document().view();
1075 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); 1075 frameView->scrollElementToRect(element, IntRect(x, y, w, h));
1076 } 1076 }
1077 1077
1078 void Internals::paintControlTints(Document* document, ExceptionState& es) 1078 void Internals::paintControlTints(Document* document, ExceptionState& exceptionS tate)
1079 { 1079 {
1080 if (!document || !document->view()) { 1080 if (!document || !document->view()) {
1081 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1081 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1082 return; 1082 return;
1083 } 1083 }
1084 1084
1085 FrameView* frameView = document->view(); 1085 FrameView* frameView = document->view();
1086 frameView->paintControlTints(); 1086 frameView->paintControlTints();
1087 } 1087 }
1088 1088
1089 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang eLocation, int rangeLength, ExceptionState& es) 1089 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang eLocation, int rangeLength, ExceptionState& exceptionState)
1090 { 1090 {
1091 if (!scope) { 1091 if (!scope) {
1092 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1092 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1093 return 0; 1093 return 0;
1094 } 1094 }
1095 1095
1096 // TextIterator depends on Layout information, make sure layout it up to dat e. 1096 // TextIterator depends on Layout information, make sure layout it up to dat e.
1097 scope->document().updateLayoutIgnorePendingStylesheets(); 1097 scope->document().updateLayoutIgnorePendingStylesheets();
1098 1098
1099 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang e(*scope); 1099 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang e(*scope);
1100 } 1100 }
1101 1101
1102 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except ionState& es) 1102 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except ionState& exceptionState)
1103 { 1103 {
1104 if (!scope || !range) { 1104 if (!scope || !range) {
1105 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1105 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1106 return 0; 1106 return 0;
1107 } 1107 }
1108 1108
1109 // PlainTextRange depends on Layout information, make sure layout it up to d ate. 1109 // PlainTextRange depends on Layout information, make sure layout it up to d ate.
1110 scope->document().updateLayoutIgnorePendingStylesheets(); 1110 scope->document().updateLayoutIgnorePendingStylesheets();
1111 1111
1112 return PlainTextRange::create(*scope, *range).start(); 1112 return PlainTextRange::create(*scope, *range).start();
1113 } 1113 }
1114 1114
1115 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio nState& es) 1115 unsigned Internals::lengthFromRange(Element* scope, const Range* range, Exceptio nState& exceptionState)
1116 { 1116 {
1117 if (!scope || !range) { 1117 if (!scope || !range) {
1118 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1118 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1119 return 0; 1119 return 0;
1120 } 1120 }
1121 1121
1122 // PlainTextRange depends on Layout information, make sure layout it up to d ate. 1122 // PlainTextRange depends on Layout information, make sure layout it up to d ate.
1123 scope->document().updateLayoutIgnorePendingStylesheets(); 1123 scope->document().updateLayoutIgnorePendingStylesheets();
1124 1124
1125 return PlainTextRange::create(*scope, *range).length(); 1125 return PlainTextRange::create(*scope, *range).length();
1126 } 1126 }
1127 1127
1128 String Internals::rangeAsText(const Range* range, ExceptionState& es) 1128 String Internals::rangeAsText(const Range* range, ExceptionState& exceptionState )
1129 { 1129 {
1130 if (!range) { 1130 if (!range) {
1131 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1131 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1132 return String(); 1132 return String();
1133 } 1133 }
1134 1134
1135 return range->text(); 1135 return range->text();
1136 } 1136 }
1137 1137
1138 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& es) 1138 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& exceptionS tate)
1139 { 1139 {
1140 if (!document || !document->frame()) { 1140 if (!document || !document->frame()) {
1141 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1141 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1142 return 0; 1142 return 0;
1143 } 1143 }
1144 1144
1145 document->updateLayout(); 1145 document->updateLayout();
1146 1146
1147 IntSize radius(width / 2, height / 2); 1147 IntSize radius(width / 2, height / 2);
1148 IntPoint point(x + radius.width(), y + radius.height()); 1148 IntPoint point(x + radius.width(), y + radius.height());
1149 1149
1150 Node* targetNode; 1150 Node* targetNode;
1151 IntPoint adjustedPoint; 1151 IntPoint adjustedPoint;
1152 1152
1153 bool foundNode = document->frame()->eventHandler().bestClickableNodeForTouch Point(point, radius, adjustedPoint, targetNode); 1153 bool foundNode = document->frame()->eventHandler().bestClickableNodeForTouch Point(point, radius, adjustedPoint, targetNode);
1154 if (foundNode) 1154 if (foundNode)
1155 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1155 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1156 1156
1157 return 0; 1157 return 0;
1158 } 1158 }
1159 1159
1160 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionState& es) 1160 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionState& exceptionState)
1161 { 1161 {
1162 if (!document || !document->frame()) { 1162 if (!document || !document->frame()) {
1163 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1163 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1164 return 0; 1164 return 0;
1165 } 1165 }
1166 1166
1167 document->updateLayout(); 1167 document->updateLayout();
1168 1168
1169 IntSize radius(width / 2, height / 2); 1169 IntSize radius(width / 2, height / 2);
1170 IntPoint point(x + radius.width(), y + radius.height()); 1170 IntPoint point(x + radius.width(), y + radius.height());
1171 1171
1172 Node* targetNode; 1172 Node* targetNode;
1173 IntPoint adjustedPoint; 1173 IntPoint adjustedPoint;
1174 document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radi us, adjustedPoint, targetNode); 1174 document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radi us, adjustedPoint, targetNode);
1175 return targetNode; 1175 return targetNode;
1176 } 1176 }
1177 1177
1178 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& es) 1178 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& exceptio nState)
1179 { 1179 {
1180 if (!document || !document->frame()) { 1180 if (!document || !document->frame()) {
1181 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1181 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1182 return 0; 1182 return 0;
1183 } 1183 }
1184 1184
1185 document->updateLayout(); 1185 document->updateLayout();
1186 1186
1187 IntSize radius(width / 2, height / 2); 1187 IntSize radius(width / 2, height / 2);
1188 IntPoint point(x + radius.width(), y + radius.height()); 1188 IntPoint point(x + radius.width(), y + radius.height());
1189 1189
1190 Node* targetNode = 0; 1190 Node* targetNode = 0;
1191 IntPoint adjustedPoint; 1191 IntPoint adjustedPoint;
1192 1192
1193 bool foundNode = document->frame()->eventHandler().bestContextMenuNodeForTou chPoint(point, radius, adjustedPoint, targetNode); 1193 bool foundNode = document->frame()->eventHandler().bestContextMenuNodeForTou chPoint(point, radius, adjustedPoint, targetNode);
1194 if (foundNode) 1194 if (foundNode)
1195 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1195 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1196 1196
1197 return DOMPoint::create(x, y); 1197 return DOMPoint::create(x, y);
1198 } 1198 }
1199 1199
1200 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionState& es) 1200 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionState& exceptionState)
1201 { 1201 {
1202 if (!document || !document->frame()) { 1202 if (!document || !document->frame()) {
1203 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1203 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1204 return 0; 1204 return 0;
1205 } 1205 }
1206 1206
1207 document->updateLayout(); 1207 document->updateLayout();
1208 1208
1209 IntSize radius(width / 2, height / 2); 1209 IntSize radius(width / 2, height / 2);
1210 IntPoint point(x + radius.width(), y + radius.height()); 1210 IntPoint point(x + radius.width(), y + radius.height());
1211 1211
1212 Node* targetNode = 0; 1212 Node* targetNode = 0;
1213 IntPoint adjustedPoint; 1213 IntPoint adjustedPoint;
1214 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra dius, adjustedPoint, targetNode); 1214 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra dius, adjustedPoint, targetNode);
1215 return targetNode; 1215 return targetNode;
1216 } 1216 }
1217 1217
1218 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& es) 1218 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& exceptionState)
1219 { 1219 {
1220 if (!document || !document->frame()) { 1220 if (!document || !document->frame()) {
1221 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1221 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1222 return 0; 1222 return 0;
1223 } 1223 }
1224 1224
1225 document->updateLayout(); 1225 document->updateLayout();
1226 1226
1227 IntSize radius(width / 2, height / 2); 1227 IntSize radius(width / 2, height / 2);
1228 IntPoint point(x + radius.width(), y + radius.height()); 1228 IntPoint point(x + radius.width(), y + radius.height());
1229 1229
1230 Node* targetNode; 1230 Node* targetNode;
1231 IntRect zoomableArea; 1231 IntRect zoomableArea;
1232 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP oint(point, radius, zoomableArea, targetNode); 1232 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP oint(point, radius, zoomableArea, targetNode);
1233 if (foundNode) 1233 if (foundNode)
1234 return ClientRect::create(zoomableArea); 1234 return ClientRect::create(zoomableArea);
1235 1235
1236 return 0; 1236 return 0;
1237 } 1237 }
1238 1238
1239 1239
1240 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState& es) 1240 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState& exceptionState)
1241 { 1241 {
1242 SpellCheckRequester* requester = spellCheckRequester(document); 1242 SpellCheckRequester* requester = spellCheckRequester(document);
1243 1243
1244 if (!requester) { 1244 if (!requester) {
1245 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1245 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1246 return -1; 1246 return -1;
1247 } 1247 }
1248 1248
1249 return requester->lastRequestSequence(); 1249 return requester->lastRequestSequence();
1250 } 1250 }
1251 1251
1252 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionStat e& es) 1252 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionStat e& exceptionState)
1253 { 1253 {
1254 SpellCheckRequester* requester = spellCheckRequester(document); 1254 SpellCheckRequester* requester = spellCheckRequester(document);
1255 1255
1256 if (!requester) { 1256 if (!requester) {
1257 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1257 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1258 return -1; 1258 return -1;
1259 } 1259 }
1260 1260
1261 return requester->lastProcessedSequence(); 1261 return requester->lastProcessedSequence();
1262 } 1262 }
1263 1263
1264 Vector<String> Internals::userPreferredLanguages() const 1264 Vector<String> Internals::userPreferredLanguages() const
1265 { 1265 {
1266 return WebCore::userPreferredLanguages(); 1266 return WebCore::userPreferredLanguages();
1267 } 1267 }
1268 1268
1269 void Internals::setUserPreferredLanguages(const Vector<String>& languages) 1269 void Internals::setUserPreferredLanguages(const Vector<String>& languages)
1270 { 1270 {
1271 WebCore::overrideUserPreferredLanguages(languages); 1271 WebCore::overrideUserPreferredLanguages(languages);
1272 } 1272 }
1273 1273
1274 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e s) 1274 unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e xceptionState)
1275 { 1275 {
1276 if (!document) { 1276 if (!document) {
1277 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1277 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1278 return 0; 1278 return 0;
1279 } 1279 }
1280 1280
1281 return WheelController::from(document)->wheelEventHandlerCount(); 1281 return WheelController::from(document)->wheelEventHandlerCount();
1282 } 1282 }
1283 1283
1284 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e s) 1284 unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e xceptionState)
1285 { 1285 {
1286 if (!document) { 1286 if (!document) {
1287 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1287 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1288 return 0; 1288 return 0;
1289 } 1289 }
1290 1290
1291 const TouchEventTargetSet* touchHandlers = document->touchEventTargets(); 1291 const TouchEventTargetSet* touchHandlers = document->touchEventTargets();
1292 if (!touchHandlers) 1292 if (!touchHandlers)
1293 return 0; 1293 return 0;
1294 1294
1295 unsigned count = 0; 1295 unsigned count = 0;
1296 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter != touchHandlers->end(); ++iter) 1296 for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter != touchHandlers->end(); ++iter)
1297 count += iter->value; 1297 count += iter->value;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 if (!layerRects[i].isEmpty()) 1393 if (!layerRects[i].isEmpty())
1394 rects->append(node, layerType, ClientRect::create(layerRects[i]) ); 1394 rects->append(node, layerType, ClientRect::create(layerRects[i]) );
1395 } 1395 }
1396 } 1396 }
1397 1397
1398 size_t numChildren = graphicsLayer->children().size(); 1398 size_t numChildren = graphicsLayer->children().size();
1399 for (size_t i = 0; i < numChildren; ++i) 1399 for (size_t i = 0; i < numChildren; ++i)
1400 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ; 1400 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects) ;
1401 } 1401 }
1402 1402
1403 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume nt, ExceptionState& es) 1403 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume nt, ExceptionState& exceptionState)
1404 { 1404 {
1405 if (!document || !document->view() || !document->page() || document != conte xtDocument()) { 1405 if (!document || !document->view() || !document->page() || document != conte xtDocument()) {
1406 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1406 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1407 return 0; 1407 return 0;
1408 } 1408 }
1409 1409
1410 // Do any pending layout and compositing update (which may call touchEventTa rgetRectsChange) to ensure this 1410 // Do any pending layout and compositing update (which may call touchEventTa rgetRectsChange) to ensure this
1411 // really takes any previous changes into account. 1411 // really takes any previous changes into account.
1412 forceCompositingUpdate(document, es); 1412 forceCompositingUpdate(document, exceptionState);
1413 if (es.hadException()) 1413 if (exceptionState.hadException())
1414 return 0; 1414 return 0;
1415 1415
1416 if (RenderView* view = document->renderView()) { 1416 if (RenderView* view = document->renderView()) {
1417 if (RenderLayerCompositor* compositor = view->compositor()) { 1417 if (RenderLayerCompositor* compositor = view->compositor()) {
1418 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) { 1418 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) {
1419 RefPtr<LayerRectList> rects = LayerRectList::create(); 1419 RefPtr<LayerRectList> rects = LayerRectList::create();
1420 accumulateLayerRectList(compositor, rootLayer, rects.get()); 1420 accumulateLayerRectList(compositor, rootLayer, rects.get());
1421 return rects; 1421 return rects;
1422 } 1422 }
1423 } 1423 }
1424 } 1424 }
1425 1425
1426 return 0; 1426 return 0;
1427 } 1427 }
1428 1428
1429 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i nt centerY, unsigned topPadding, unsigned rightPadding, 1429 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i nt centerY, unsigned topPadding, unsigned rightPadding,
1430 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo wShadowContent, bool allowChildFrameContent, ExceptionState& es) const 1430 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo wShadowContent, bool allowChildFrameContent, ExceptionState& exceptionState) con st
1431 { 1431 {
1432 if (!document || !document->frame() || !document->frame()->view()) { 1432 if (!document || !document->frame() || !document->frame()->view()) {
1433 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1433 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1434 return 0; 1434 return 0;
1435 } 1435 }
1436 1436
1437 Frame* frame = document->frame(); 1437 Frame* frame = document->frame();
1438 FrameView* frameView = document->view(); 1438 FrameView* frameView = document->view();
1439 RenderView* renderView = document->renderView(); 1439 RenderView* renderView = document->renderView();
1440 1440
1441 if (!renderView) 1441 if (!renderView)
1442 return 0; 1442 return 0;
1443 1443
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 Vector<unsigned long> Internals::setMemoryCacheCapacities(unsigned long minDeadB ytes, unsigned long maxDeadBytes, unsigned long totalBytes) 1586 Vector<unsigned long> Internals::setMemoryCacheCapacities(unsigned long minDeadB ytes, unsigned long maxDeadBytes, unsigned long totalBytes)
1587 { 1587 {
1588 Vector<unsigned long> result; 1588 Vector<unsigned long> result;
1589 result.append(memoryCache()->minDeadCapacity()); 1589 result.append(memoryCache()->minDeadCapacity());
1590 result.append(memoryCache()->maxDeadCapacity()); 1590 result.append(memoryCache()->maxDeadCapacity());
1591 result.append(memoryCache()->capacity()); 1591 result.append(memoryCache()->capacity());
1592 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes); 1592 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes);
1593 return result; 1593 return result;
1594 } 1594 }
1595 1595
1596 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS ize, int maximumSingleResourceContentSize, ExceptionState& es) 1596 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentS ize, int maximumSingleResourceContentSize, ExceptionState& exceptionState)
1597 { 1597 {
1598 Page* page = contextDocument()->frame()->page(); 1598 Page* page = contextDocument()->frame()->page();
1599 if (!page) { 1599 if (!page) {
1600 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1600 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1601 return; 1601 return;
1602 } 1602 }
1603 page->inspectorController().setResourcesDataSizeLimitsFromInternals(maximumR esourcesContentSize, maximumSingleResourceContentSize); 1603 page->inspectorController().setResourcesDataSizeLimitsFromInternals(maximumR esourcesContentSize, maximumSingleResourceContentSize);
1604 } 1604 }
1605 1605
1606 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionState&) 1606 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionState&)
1607 { 1607 {
1608 if (!document || !document->frame()) 1608 if (!document || !document->frame())
1609 return 0; 1609 return 0;
1610 1610
1611 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document Marker::Grammar, from, length); 1611 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document Marker::Grammar, from, length);
1612 } 1612 }
1613 1613
1614 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&) 1614 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&)
1615 { 1615 {
1616 unsigned count = 0; 1616 unsigned count = 0;
1617 Frame* frame = document->frame(); 1617 Frame* frame = document->frame();
1618 if (frame->view()->scrollableAreas()) 1618 if (frame->view()->scrollableAreas())
1619 count += frame->view()->scrollableAreas()->size(); 1619 count += frame->view()->scrollableAreas()->size();
1620 1620
1621 for (Frame* child = frame->tree().firstChild(); child; child = child->tree() .nextSibling()) { 1621 for (Frame* child = frame->tree().firstChild(); child; child = child->tree() .nextSibling()) {
1622 if (child->view() && child->view()->scrollableAreas()) 1622 if (child->view() && child->view()->scrollableAreas())
1623 count += child->view()->scrollableAreas()->size(); 1623 count += child->view()->scrollableAreas()->size();
1624 } 1624 }
1625 1625
1626 return count; 1626 return count;
1627 } 1627 }
1628 1628
1629 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& es) 1629 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& exceptionState)
1630 { 1630 {
1631 if (!document) { 1631 if (!document) {
1632 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1632 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1633 return false; 1633 return false;
1634 } 1634 }
1635 1635
1636 return document->isPageBoxVisible(pageNumber); 1636 return document->isPageBoxVisible(pageNumber);
1637 } 1637 }
1638 1638
1639 String Internals::layerTreeAsText(Document* document, ExceptionState& es) const 1639 String Internals::layerTreeAsText(Document* document, ExceptionState& exceptionS tate) const
1640 { 1640 {
1641 return layerTreeAsText(document, 0, es); 1641 return layerTreeAsText(document, 0, exceptionState);
1642 } 1642 }
1643 1643
1644 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& es) c onst 1644 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& excep tionState) const
1645 { 1645 {
1646 return elementLayerTreeAsText(element, 0, es); 1646 return elementLayerTreeAsText(element, 0, exceptionState);
1647 } 1647 }
1648 1648
1649 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& es, RenderLayerStackingNode::PaintOrderListType type) 1649 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& exc eptionState, RenderLayerStackingNode::PaintOrderListType type)
1650 { 1650 {
1651 if (!element) { 1651 if (!element) {
1652 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1652 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1653 return 0; 1653 return 0;
1654 } 1654 }
1655 1655
1656 element->document().updateLayout(); 1656 element->document().updateLayout();
1657 1657
1658 RenderObject* renderer = element->renderer(); 1658 RenderObject* renderer = element->renderer();
1659 if (!renderer || !renderer->isBox()) { 1659 if (!renderer || !renderer->isBox()) {
1660 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1660 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1661 return 0; 1661 return 0;
1662 } 1662 }
1663 1663
1664 RenderLayer* layer = toRenderBox(renderer)->layer(); 1664 RenderLayer* layer = toRenderBox(renderer)->layer();
1665 if (!layer) { 1665 if (!layer) {
1666 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1666 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1667 return 0; 1667 return 0;
1668 } 1668 }
1669 1669
1670 Vector<RefPtr<Node> > nodes; 1670 Vector<RefPtr<Node> > nodes;
1671 layer->stackingNode()->computePaintOrderList(type, nodes); 1671 layer->stackingNode()->computePaintOrderList(type, nodes);
1672 return StaticNodeList::adopt(nodes); 1672 return StaticNodeList::adopt(nodes);
1673 } 1673 }
1674 1674
1675 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex ceptionState& es) 1675 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex ceptionState& exceptionState)
1676 { 1676 {
1677 return paintOrderList(element, es, RenderLayerStackingNode::BeforePromote); 1677 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Befo rePromote);
1678 } 1678 }
1679 1679
1680 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc eptionState& es) 1680 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc eptionState& exceptionState)
1681 { 1681 {
1682 return paintOrderList(element, es, RenderLayerStackingNode::AfterPromote); 1682 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Afte rPromote);
1683 } 1683 }
1684 1684
1685 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& es) 1685 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState)
1686 { 1686 {
1687 if (!element1 || !element2) { 1687 if (!element1 || !element2) {
1688 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1688 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1689 return 0; 1689 return 0;
1690 } 1690 }
1691 1691
1692 element1->document().updateLayout(); 1692 element1->document().updateLayout();
1693 1693
1694 RenderObject* renderer1 = element1->renderer(); 1694 RenderObject* renderer1 = element1->renderer();
1695 RenderObject* renderer2 = element2->renderer(); 1695 RenderObject* renderer2 = element2->renderer();
1696 if (!renderer1 || !renderer2 || !renderer1->isBox() || !renderer2->isBox()) { 1696 if (!renderer1 || !renderer2 || !renderer1->isBox() || !renderer2->isBox()) {
1697 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1697 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1698 return 0; 1698 return 0;
1699 } 1699 }
1700 1700
1701 RenderLayer* layer1 = toRenderBox(renderer1)->layer(); 1701 RenderLayer* layer1 = toRenderBox(renderer1)->layer();
1702 RenderLayer* layer2 = toRenderBox(renderer2)->layer(); 1702 RenderLayer* layer2 = toRenderBox(renderer2)->layer();
1703 if (!layer1 || !layer2) { 1703 if (!layer1 || !layer2) {
1704 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1704 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1705 return 0; 1705 return 0;
1706 } 1706 }
1707 1707
1708 return layer1->scrollsWithRespectTo(layer2); 1708 return layer1->scrollsWithRespectTo(layer2);
1709 } 1709 }
1710 1710
1711 bool Internals::isUnclippedDescendant(Element* element, ExceptionState& es) 1711 bool Internals::isUnclippedDescendant(Element* element, ExceptionState& exceptio nState)
1712 { 1712 {
1713 if (!element) { 1713 if (!element) {
1714 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1714 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1715 return 0; 1715 return 0;
1716 } 1716 }
1717 1717
1718 element->document().updateLayout(); 1718 element->document().updateLayout();
1719 1719
1720 RenderObject* renderer = element->renderer(); 1720 RenderObject* renderer = element->renderer();
1721 if (!renderer || !renderer->isBox()) { 1721 if (!renderer || !renderer->isBox()) {
1722 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1722 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1723 return 0; 1723 return 0;
1724 } 1724 }
1725 1725
1726 RenderLayer* layer = toRenderBox(renderer)->layer(); 1726 RenderLayer* layer = toRenderBox(renderer)->layer();
1727 if (!layer) { 1727 if (!layer) {
1728 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1728 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1729 return 0; 1729 return 0;
1730 } 1730 }
1731 1731
1732 return layer->isUnclippedDescendant(); 1732 return layer->isUnclippedDescendant();
1733 } 1733 }
1734 1734
1735 bool Internals::needsCompositedScrolling(Element* element, ExceptionState& es) 1735 bool Internals::needsCompositedScrolling(Element* element, ExceptionState& excep tionState)
1736 { 1736 {
1737 if (!element) { 1737 if (!element) {
1738 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1738 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1739 return 0; 1739 return 0;
1740 } 1740 }
1741 1741
1742 element->document().updateLayout(); 1742 element->document().updateLayout();
1743 1743
1744 RenderObject* renderer = element->renderer(); 1744 RenderObject* renderer = element->renderer();
1745 if (!renderer || !renderer->isBox()) { 1745 if (!renderer || !renderer->isBox()) {
1746 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1746 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1747 return 0; 1747 return 0;
1748 } 1748 }
1749 1749
1750 RenderLayer* layer = toRenderBox(renderer)->layer(); 1750 RenderLayer* layer = toRenderBox(renderer)->layer();
1751 if (!layer) { 1751 if (!layer) {
1752 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1752 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1753 return 0; 1753 return 0;
1754 } 1754 }
1755 1755
1756 return layer->needsCompositedScrolling(); 1756 return layer->needsCompositedScrolling();
1757 } 1757 }
1758 1758
1759 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& es) const 1759 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& exceptionState) const
1760 { 1760 {
1761 if (!document || !document->frame()) { 1761 if (!document || !document->frame()) {
1762 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1762 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1763 return String(); 1763 return String();
1764 } 1764 }
1765 1765
1766 return document->frame()->layerTreeAsText(flags); 1766 return document->frame()->layerTreeAsText(flags);
1767 } 1767 }
1768 1768
1769 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& es) const 1769 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const
1770 { 1770 {
1771 if (!element) { 1771 if (!element) {
1772 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1772 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1773 return String(); 1773 return String();
1774 } 1774 }
1775 1775
1776 element->document().updateLayout(); 1776 element->document().updateLayout();
1777 1777
1778 RenderObject* renderer = element->renderer(); 1778 RenderObject* renderer = element->renderer();
1779 if (!renderer || !renderer->isBox()) { 1779 if (!renderer || !renderer->isBox()) {
1780 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1780 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1781 return String(); 1781 return String();
1782 } 1782 }
1783 1783
1784 RenderLayer* layer = toRenderBox(renderer)->layer(); 1784 RenderLayer* layer = toRenderBox(renderer)->layer();
1785 if (!layer 1785 if (!layer
1786 || !layer->hasCompositedLayerMapping() 1786 || !layer->hasCompositedLayerMapping()
1787 || !layer->compositedLayerMapping()->mainGraphicsLayer()) { 1787 || !layer->compositedLayerMapping()->mainGraphicsLayer()) {
1788 // Don't raise exception in these cases which may be normally used in te sts. 1788 // Don't raise exception in these cases which may be normally used in te sts.
1789 return String(); 1789 return String();
1790 } 1790 }
1791 1791
1792 return layer->compositedLayerMapping()->mainGraphicsLayer()->layerTreeAsText (flags); 1792 return layer->compositedLayerMapping()->mainGraphicsLayer()->layerTreeAsText (flags);
1793 } 1793 }
1794 1794
1795 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& e s) 1795 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& e xceptionState)
1796 { 1796 {
1797 if (!element) { 1797 if (!element) {
1798 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1798 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1799 return 0; 1799 return 0;
1800 } 1800 }
1801 1801
1802 RenderObject* renderer = element->renderer(); 1802 RenderObject* renderer = element->renderer();
1803 if (!renderer || !renderer->isBox()) { 1803 if (!renderer || !renderer->isBox()) {
1804 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1804 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1805 return 0; 1805 return 0;
1806 } 1806 }
1807 1807
1808 RenderLayer* layer = toRenderBox(renderer)->layer(); 1808 RenderLayer* layer = toRenderBox(renderer)->layer();
1809 if (!layer) { 1809 if (!layer) {
1810 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1810 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1811 return 0; 1811 return 0;
1812 } 1812 }
1813 1813
1814 return layer; 1814 return layer;
1815 } 1815 }
1816 1816
1817 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp ositedScrolling, ExceptionState& es) 1817 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp ositedScrolling, ExceptionState& exceptionState)
1818 { 1818 {
1819 if (!element) { 1819 if (!element) {
1820 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1820 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1821 return; 1821 return;
1822 } 1822 }
1823 1823
1824 element->document().updateLayout(); 1824 element->document().updateLayout();
1825 1825
1826 if (RenderLayer* layer = getRenderLayerForElement(element, es)) 1826 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState))
1827 layer->scrollableArea()->setForceNeedsCompositedScrolling(static_cast<Fo rceNeedsCompositedScrollingMode>(needsCompositedScrolling)); 1827 layer->scrollableArea()->setForceNeedsCompositedScrolling(static_cast<Fo rceNeedsCompositedScrollingMode>(needsCompositedScrolling));
1828 } 1828 }
1829 1829
1830 String Internals::repaintRectsAsText(Document* document, ExceptionState& es) con st 1830 String Internals::repaintRectsAsText(Document* document, ExceptionState& excepti onState) const
1831 { 1831 {
1832 if (!document || !document->frame()) { 1832 if (!document || !document->frame()) {
1833 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1833 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1834 return String(); 1834 return String();
1835 } 1835 }
1836 1836
1837 return document->frame()->trackedRepaintRectsAsText(); 1837 return document->frame()->trackedRepaintRectsAsText();
1838 } 1838 }
1839 1839
1840 PassRefPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionSt ate& es) const 1840 PassRefPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionSt ate& exceptionState) const
1841 { 1841 {
1842 if (!element) { 1842 if (!element) {
1843 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1843 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1844 return 0; 1844 return 0;
1845 } 1845 }
1846 1846
1847 if (RenderLayer* layer = getRenderLayerForElement(element, es)) { 1847 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState)) {
1848 if (layer->compositingState() == PaintsIntoOwnBacking) { 1848 if (layer->compositingState() == PaintsIntoOwnBacking) {
1849 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects (); 1849 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects ();
1850 ASSERT(rects.get()); 1850 ASSERT(rects.get());
1851 Vector<FloatQuad> quads(rects->size()); 1851 Vector<FloatQuad> quads(rects->size());
1852 for (size_t i = 0; i < rects->size(); ++i) 1852 for (size_t i = 0; i < rects->size(); ++i)
1853 quads[i] = FloatRect(rects->at(i)); 1853 quads[i] = FloatRect(rects->at(i));
1854 return ClientRectList::create(quads); 1854 return ClientRectList::create(quads);
1855 } 1855 }
1856 } 1856 }
1857 1857
1858 // It's an error to call this on an element that's not composited. 1858 // It's an error to call this on an element that's not composited.
1859 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1859 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
1860 return 0; 1860 return 0;
1861 } 1861 }
1862 1862
1863 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e s) const 1863 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e xceptionState) const
1864 { 1864 {
1865 return String(); 1865 return String();
1866 } 1866 }
1867 1867
1868 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& es) const 1868 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& exceptionState) const
1869 { 1869 {
1870 if (!document || !document->frame()) { 1870 if (!document || !document->frame()) {
1871 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1871 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1872 return String(); 1872 return String();
1873 } 1873 }
1874 1874
1875 // Force a re-layout and a compositing update. 1875 // Force a re-layout and a compositing update.
1876 document->updateLayout(); 1876 document->updateLayout();
1877 RenderView* view = document->renderView(); 1877 RenderView* view = document->renderView();
1878 if (view->compositor()) 1878 if (view->compositor())
1879 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork); 1879 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork);
1880 1880
1881 Page* page = document->page(); 1881 Page* page = document->page();
1882 if (!page) 1882 if (!page)
1883 return String(); 1883 return String();
1884 1884
1885 return page->mainThreadScrollingReasonsAsText(); 1885 return page->mainThreadScrollingReasonsAsText();
1886 } 1886 }
1887 1887
1888 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& es) const 1888 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& exceptionState) const
1889 { 1889 {
1890 if (!document || !document->frame()) { 1890 if (!document || !document->frame()) {
1891 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1891 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1892 return 0; 1892 return 0;
1893 } 1893 }
1894 1894
1895 Page* page = document->page(); 1895 Page* page = document->page();
1896 if (!page) 1896 if (!page)
1897 return 0; 1897 return 0;
1898 1898
1899 return page->nonFastScrollableRects(document->frame()); 1899 return page->nonFastScrollableRects(document->frame());
1900 } 1900 }
1901 1901
1902 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta te& es) const 1902 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta te& exceptionState) const
1903 { 1903 {
1904 if (!document) { 1904 if (!document) {
1905 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1905 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1906 return; 1906 return;
1907 } 1907 }
1908 ResourceFetcher* fetcher = document->fetcher(); 1908 ResourceFetcher* fetcher = document->fetcher();
1909 if (!fetcher) 1909 if (!fetcher)
1910 return; 1910 return;
1911 fetcher->garbageCollectDocumentResources(); 1911 fetcher->garbageCollectDocumentResources();
1912 } 1912 }
1913 1913
1914 void Internals::evictAllResources() const 1914 void Internals::evictAllResources() const
1915 { 1915 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 } 1960 }
1961 1961
1962 int Internals::numberOfPages(float pageWidth, float pageHeight) 1962 int Internals::numberOfPages(float pageWidth, float pageHeight)
1963 { 1963 {
1964 if (!frame()) 1964 if (!frame())
1965 return -1; 1965 return -1;
1966 1966
1967 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight) ); 1967 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight) );
1968 } 1968 }
1969 1969
1970 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta te& es) const 1970 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta te& exceptionState) const
1971 { 1971 {
1972 if (!frame()) { 1972 if (!frame()) {
1973 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1973 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1974 return String(); 1974 return String();
1975 } 1975 }
1976 1976
1977 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN umber); 1977 return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageN umber);
1978 } 1978 }
1979 1979
1980 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& es) const 1980 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& exceptionState) const
1981 { 1981 {
1982 if (!frame()) { 1982 if (!frame()) {
1983 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1983 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1984 return String(); 1984 return String();
1985 } 1985 }
1986 1986
1987 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); 1987 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
1988 } 1988 }
1989 1989
1990 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionState& es) 1990 void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionState& exceptio nState)
1991 { 1991 {
1992 Document* document = contextDocument(); 1992 Document* document = contextDocument();
1993 if (!document || !document->page()) { 1993 if (!document || !document->page()) {
1994 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 1994 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1995 return; 1995 return;
1996 } 1996 }
1997 Page* page = document->page(); 1997 Page* page = document->page();
1998 page->setDeviceScaleFactor(scaleFactor); 1998 page->setDeviceScaleFactor(scaleFactor);
1999 } 1999 }
2000 2000
2001 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception State& es) 2001 void Internals::setIsCursorVisible(Document* document, bool isVisible, Exception State& exceptionState)
2002 { 2002 {
2003 if (!document || !document->page()) { 2003 if (!document || !document->page()) {
2004 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2004 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2005 return; 2005 return;
2006 } 2006 }
2007 document->page()->setIsCursorVisible(isVisible); 2007 document->page()->setIsCursorVisible(isVisible);
2008 } 2008 }
2009 2009
2010 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element) 2010 void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element)
2011 { 2011 {
2012 if (!document) 2012 if (!document)
2013 return; 2013 return;
2014 FullscreenElementStack::from(document)->webkitWillEnterFullScreenForElement( element); 2014 FullscreenElementStack::from(document)->webkitWillEnterFullScreenForElement( element);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 { 2054 {
2055 return TypeConversions::create(); 2055 return TypeConversions::create();
2056 } 2056 }
2057 2057
2058 Vector<String> Internals::getReferencedFilePaths() const 2058 Vector<String> Internals::getReferencedFilePaths() const
2059 { 2059 {
2060 frame()->loader().history()->saveDocumentAndScrollState(); 2060 frame()->loader().history()->saveDocumentAndScrollState();
2061 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem()->documentState()); 2061 return FormController::getReferencedFilePaths(frame()->loader().history()->c urrentItem()->documentState());
2062 } 2062 }
2063 2063
2064 void Internals::startTrackingRepaints(Document* document, ExceptionState& es) 2064 void Internals::startTrackingRepaints(Document* document, ExceptionState& except ionState)
2065 { 2065 {
2066 if (!document || !document->view()) { 2066 if (!document || !document->view()) {
2067 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2067 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2068 return; 2068 return;
2069 } 2069 }
2070 2070
2071 FrameView* frameView = document->view(); 2071 FrameView* frameView = document->view();
2072 frameView->setTracksRepaints(true); 2072 frameView->setTracksRepaints(true);
2073 } 2073 }
2074 2074
2075 void Internals::stopTrackingRepaints(Document* document, ExceptionState& es) 2075 void Internals::stopTrackingRepaints(Document* document, ExceptionState& excepti onState)
2076 { 2076 {
2077 if (!document || !document->view()) { 2077 if (!document || !document->view()) {
2078 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2078 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2079 return; 2079 return;
2080 } 2080 }
2081 2081
2082 FrameView* frameView = document->view(); 2082 FrameView* frameView = document->view();
2083 frameView->setTracksRepaints(false); 2083 frameView->setTracksRepaints(false);
2084 } 2084 }
2085 2085
2086 PassRefPtr<ClientRectList> Internals::draggableRegions(Document* document, Excep tionState& es) 2086 PassRefPtr<ClientRectList> Internals::draggableRegions(Document* document, Excep tionState& exceptionState)
2087 { 2087 {
2088 return annotatedRegions(document, true, es); 2088 return annotatedRegions(document, true, exceptionState);
2089 } 2089 }
2090 2090
2091 PassRefPtr<ClientRectList> Internals::nonDraggableRegions(Document* document, Ex ceptionState& es) 2091 PassRefPtr<ClientRectList> Internals::nonDraggableRegions(Document* document, Ex ceptionState& exceptionState)
2092 { 2092 {
2093 return annotatedRegions(document, false, es); 2093 return annotatedRegions(document, false, exceptionState);
2094 } 2094 }
2095 2095
2096 PassRefPtr<ClientRectList> Internals::annotatedRegions(Document* document, bool draggable, ExceptionState& es) 2096 PassRefPtr<ClientRectList> Internals::annotatedRegions(Document* document, bool draggable, ExceptionState& exceptionState)
2097 { 2097 {
2098 if (!document || !document->view()) { 2098 if (!document || !document->view()) {
2099 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2099 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2100 return ClientRectList::create(); 2100 return ClientRectList::create();
2101 } 2101 }
2102 2102
2103 document->updateLayout(); 2103 document->updateLayout();
2104 document->view()->updateAnnotatedRegions(); 2104 document->view()->updateAnnotatedRegions();
2105 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); 2105 Vector<AnnotatedRegionValue> regions = document->annotatedRegions();
2106 2106
2107 Vector<FloatQuad> quads; 2107 Vector<FloatQuad> quads;
2108 for (size_t i = 0; i < regions.size(); ++i) { 2108 for (size_t i = 0; i < regions.size(); ++i) {
2109 if (regions[i].draggable == draggable) 2109 if (regions[i].draggable == draggable)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 case Cursor::ZoomOut: return "ZoomOut"; 2158 case Cursor::ZoomOut: return "ZoomOut";
2159 case Cursor::Grab: return "Grab"; 2159 case Cursor::Grab: return "Grab";
2160 case Cursor::Grabbing: return "Grabbing"; 2160 case Cursor::Grabbing: return "Grabbing";
2161 case Cursor::Custom: return "Custom"; 2161 case Cursor::Custom: return "Custom";
2162 } 2162 }
2163 2163
2164 ASSERT_NOT_REACHED(); 2164 ASSERT_NOT_REACHED();
2165 return "UNKNOWN"; 2165 return "UNKNOWN";
2166 } 2166 }
2167 2167
2168 String Internals::getCurrentCursorInfo(Document* document, ExceptionState& es) 2168 String Internals::getCurrentCursorInfo(Document* document, ExceptionState& excep tionState)
2169 { 2169 {
2170 if (!document || !document->frame()) { 2170 if (!document || !document->frame()) {
2171 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2171 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2172 return String(); 2172 return String();
2173 } 2173 }
2174 2174
2175 Cursor cursor = document->frame()->eventHandler().currentMouseCursor(); 2175 Cursor cursor = document->frame()->eventHandler().currentMouseCursor();
2176 2176
2177 StringBuilder result; 2177 StringBuilder result;
2178 result.append("type="); 2178 result.append("type=");
2179 result.append(cursorTypeToString(cursor.type())); 2179 result.append(cursorTypeToString(cursor.type()));
2180 result.append(" hotSpot="); 2180 result.append(" hotSpot=");
2181 result.appendNumber(cursor.hotSpot().x()); 2181 result.appendNumber(cursor.hotSpot().x());
(...skipping 27 matching lines...) Expand all
2209 { 2209 {
2210 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar)); 2210 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar));
2211 return SerializedScriptValue::createFromWire(value); 2211 return SerializedScriptValue::createFromWire(value);
2212 } 2212 }
2213 2213
2214 void Internals::forceReload(bool endToEnd) 2214 void Internals::forceReload(bool endToEnd)
2215 { 2215 {
2216 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload); 2216 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload);
2217 } 2217 }
2218 2218
2219 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es) 2219 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& exceptionState )
2220 { 2220 {
2221 Document* document = contextDocument(); 2221 Document* document = contextDocument();
2222 if (!document || !document->frame()) { 2222 if (!document || !document->frame()) {
2223 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2223 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2224 return 0; 2224 return 0;
2225 } 2225 }
2226 2226
2227 return ClientRect::create(document->frame()->selection().bounds()); 2227 return ClientRect::create(document->frame()->selection().bounds());
2228 } 2228 }
2229 2229
2230 String Internals::markerTextForListItem(Element* element, ExceptionState& es) 2230 String Internals::markerTextForListItem(Element* element, ExceptionState& except ionState)
2231 { 2231 {
2232 if (!element) { 2232 if (!element) {
2233 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2233 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2234 return String(); 2234 return String();
2235 } 2235 }
2236 return WebCore::markerTextForListItem(element); 2236 return WebCore::markerTextForListItem(element);
2237 } 2237 }
2238 2238
2239 String Internals::getImageSourceURL(Element* element, ExceptionState& es) 2239 String Internals::getImageSourceURL(Element* element, ExceptionState& exceptionS tate)
2240 { 2240 {
2241 if (!element) { 2241 if (!element) {
2242 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2242 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2243 return String(); 2243 return String();
2244 } 2244 }
2245 return element->imageSourceURL(); 2245 return element->imageSourceURL();
2246 } 2246 }
2247 2247
2248 String Internals::baseURL(Document* document, ExceptionState& es) 2248 String Internals::baseURL(Document* document, ExceptionState& exceptionState)
2249 { 2249 {
2250 if (!document) { 2250 if (!document) {
2251 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2251 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2252 return String(); 2252 return String();
2253 } 2253 }
2254 2254
2255 return document->baseURL().string(); 2255 return document->baseURL().string();
2256 } 2256 }
2257 2257
2258 bool Internals::isSelectPopupVisible(Node* node) 2258 bool Internals::isSelectPopupVisible(Node* node)
2259 { 2259 {
2260 if (!node->hasTagName(HTMLNames::selectTag)) 2260 if (!node->hasTagName(HTMLNames::selectTag))
2261 return false; 2261 return false;
(...skipping 14 matching lines...) Expand all
2276 if (!sharedContext) 2276 if (!sharedContext)
2277 return false; 2277 return false;
2278 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2278 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2279 // To prevent tests that call loseSharedGraphicsContext3D from being 2279 // To prevent tests that call loseSharedGraphicsContext3D from being
2280 // flaky, we call finish so that the context is guaranteed to be lost 2280 // flaky, we call finish so that the context is guaranteed to be lost
2281 // synchronously (i.e. before returning). 2281 // synchronously (i.e. before returning).
2282 sharedContext->finish(); 2282 sharedContext->finish();
2283 return true; 2283 return true;
2284 } 2284 }
2285 2285
2286 void Internals::forceCompositingUpdate(Document* document, ExceptionState& es) 2286 void Internals::forceCompositingUpdate(Document* document, ExceptionState& excep tionState)
2287 { 2287 {
2288 if (!document || !document->renderView()) { 2288 if (!document || !document->renderView()) {
2289 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 2289 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
2290 return; 2290 return;
2291 } 2291 }
2292 2292
2293 document->updateLayout(); 2293 document->updateLayout();
2294 2294
2295 RenderView* view = document->renderView(); 2295 RenderView* view = document->renderView();
2296 if (view->compositor()) 2296 if (view->compositor())
2297 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork); 2297 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork);
2298 } 2298 }
2299 2299
2300 } 2300 }
OLDNEW
« no previous file with comments | « Source/core/testing/InternalSettings.cpp ('k') | Source/core/timing/Performance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698