OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ASSERT(node); | 363 ASSERT(node); |
364 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); | 364 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); |
365 return parentTreeScope ? &parentTreeScope->rootNode() : 0; | 365 return parentTreeScope ? &parentTreeScope->rootNode() : 0; |
366 } | 366 } |
367 | 367 |
368 bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idVa
lue, ExceptionState& exceptionState) | 368 bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idVa
lue, ExceptionState& exceptionState) |
369 { | 369 { |
370 ASSERT(host); | 370 ASSERT(host); |
371 if (!host->shadow()) { | 371 if (!host->shadow()) { |
372 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 372 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); |
373 return 0; | 373 return false; |
374 } | 374 } |
375 | 375 |
376 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); | 376 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); |
377 } | 377 } |
378 | 378 |
379 bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& c
lassName, ExceptionState& exceptionState) | 379 bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& c
lassName, ExceptionState& exceptionState) |
380 { | 380 { |
381 ASSERT(host); | 381 ASSERT(host); |
382 if (!host->shadow()) { | 382 if (!host->shadow()) { |
383 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 383 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); |
384 return 0; | 384 return false; |
385 } | 385 } |
386 | 386 |
387 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam
e); | 387 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam
e); |
388 } | 388 } |
389 | 389 |
390 bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicStrin
g& attributeName, ExceptionState& exceptionState) | 390 bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicStrin
g& attributeName, ExceptionState& exceptionState) |
391 { | 391 { |
392 ASSERT(host); | 392 ASSERT(host); |
393 if (!host->shadow()) { | 393 if (!host->shadow()) { |
394 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 394 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); |
395 return 0; | 395 return false; |
396 } | 396 } |
397 | 397 |
398 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr
ibuteName); | 398 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr
ibuteName); |
399 } | 399 } |
400 | 400 |
401 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p
seudoClass, ExceptionState& exceptionState) | 401 bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& p
seudoClass, ExceptionState& exceptionState) |
402 { | 402 { |
403 ASSERT(host); | 403 ASSERT(host); |
404 if (!host->shadow()) { | 404 if (!host->shadow()) { |
405 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 405 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); |
(...skipping 25 matching lines...) Expand all Loading... |
431 | 431 |
432 frame()->view()->updateLayoutAndStyleForPainting(); | 432 frame()->view()->updateLayoutAndStyleForPainting(); |
433 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime); | 433 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime); |
434 } | 434 } |
435 | 435 |
436 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except
ionState) const | 436 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& except
ionState) const |
437 { | 437 { |
438 ASSERT(root); | 438 ASSERT(root); |
439 if (!root->isShadowRoot()) { | 439 if (!root->isShadowRoot()) { |
440 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); | 440 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); |
441 return 0; | 441 return false; |
442 } | 442 } |
443 return toShadowRoot(root)->containsShadowElements(); | 443 return toShadowRoot(root)->containsShadowElements(); |
444 } | 444 } |
445 | 445 |
446 bool Internals::hasContentElement(const Node* root, ExceptionState& exceptionSta
te) const | 446 bool Internals::hasContentElement(const Node* root, ExceptionState& exceptionSta
te) const |
447 { | 447 { |
448 ASSERT(root); | 448 ASSERT(root); |
449 if (!root->isShadowRoot()) { | 449 if (!root->isShadowRoot()) { |
450 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); | 450 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); |
451 return 0; | 451 return false; |
452 } | 452 } |
453 return toShadowRoot(root)->containsContentElements(); | 453 return toShadowRoot(root)->containsContentElements(); |
454 } | 454 } |
455 | 455 |
456 size_t Internals::countElementShadow(const Node* root, ExceptionState& exception
State) const | 456 size_t Internals::countElementShadow(const Node* root, ExceptionState& exception
State) const |
457 { | 457 { |
458 ASSERT(root); | 458 ASSERT(root); |
459 if (!root->isShadowRoot()) { | 459 if (!root->isShadowRoot()) { |
460 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); | 460 exceptionState.throwDOMException(InvalidAccessError, "The node argument
is not a shadow root."); |
461 return 0; | 461 return 0; |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 copyToVector(result.rectBasedTestResult(), matches); | 1392 copyToVector(result.rectBasedTestResult(), matches); |
1393 } | 1393 } |
1394 | 1394 |
1395 return StaticNodeList::adopt(matches); | 1395 return StaticNodeList::adopt(matches); |
1396 } | 1396 } |
1397 | 1397 |
1398 bool Internals::hasSpellingMarker(Document* document, int from, int length) | 1398 bool Internals::hasSpellingMarker(Document* document, int from, int length) |
1399 { | 1399 { |
1400 ASSERT(document); | 1400 ASSERT(document); |
1401 if (!document->frame()) | 1401 if (!document->frame()) |
1402 return 0; | 1402 return false; |
1403 | 1403 |
1404 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document
Marker::Spelling, from, length); | 1404 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document
Marker::Spelling, from, length); |
1405 } | 1405 } |
1406 | 1406 |
1407 void Internals::setContinuousSpellCheckingEnabled(bool enabled) | 1407 void Internals::setContinuousSpellCheckingEnabled(bool enabled) |
1408 { | 1408 { |
1409 if (!contextDocument() || !contextDocument()->frame()) | 1409 if (!contextDocument() || !contextDocument()->frame()) |
1410 return; | 1410 return; |
1411 | 1411 |
1412 if (enabled != contextDocument()->frame()->spellChecker().isContinuousSpellC
heckingEnabled()) | 1412 if (enabled != contextDocument()->frame()->spellChecker().isContinuousSpellC
heckingEnabled()) |
1413 contextDocument()->frame()->spellChecker().toggleContinuousSpellChecking
(); | 1413 contextDocument()->frame()->spellChecker().toggleContinuousSpellChecking
(); |
1414 } | 1414 } |
1415 | 1415 |
1416 bool Internals::isOverwriteModeEnabled(Document* document) | 1416 bool Internals::isOverwriteModeEnabled(Document* document) |
1417 { | 1417 { |
1418 ASSERT(document); | 1418 ASSERT(document); |
1419 if (!document->frame()) | 1419 if (!document->frame()) |
1420 return 0; | 1420 return false; |
1421 | 1421 |
1422 return document->frame()->editor().isOverwriteModeEnabled(); | 1422 return document->frame()->editor().isOverwriteModeEnabled(); |
1423 } | 1423 } |
1424 | 1424 |
1425 void Internals::toggleOverwriteModeEnabled(Document* document) | 1425 void Internals::toggleOverwriteModeEnabled(Document* document) |
1426 { | 1426 { |
1427 ASSERT(document); | 1427 ASSERT(document); |
1428 if (!document->frame()) | 1428 if (!document->frame()) |
1429 return; | 1429 return; |
1430 | 1430 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 result.append(memoryCache()->maxDeadCapacity()); | 1466 result.append(memoryCache()->maxDeadCapacity()); |
1467 result.append(memoryCache()->capacity()); | 1467 result.append(memoryCache()->capacity()); |
1468 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes); | 1468 memoryCache()->setCapacities(minDeadBytes, maxDeadBytes, totalBytes); |
1469 return result; | 1469 return result; |
1470 } | 1470 } |
1471 | 1471 |
1472 bool Internals::hasGrammarMarker(Document* document, int from, int length) | 1472 bool Internals::hasGrammarMarker(Document* document, int from, int length) |
1473 { | 1473 { |
1474 ASSERT(document); | 1474 ASSERT(document); |
1475 if (!document->frame()) | 1475 if (!document->frame()) |
1476 return 0; | 1476 return false; |
1477 | 1477 |
1478 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document
Marker::Grammar, from, length); | 1478 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document
Marker::Grammar, from, length); |
1479 } | 1479 } |
1480 | 1480 |
1481 unsigned Internals::numberOfScrollableAreas(Document* document) | 1481 unsigned Internals::numberOfScrollableAreas(Document* document) |
1482 { | 1482 { |
1483 ASSERT(document); | 1483 ASSERT(document); |
1484 if (!document->frame()) | 1484 if (!document->frame()) |
1485 return 0; | 1485 return 0; |
1486 | 1486 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 | 1519 |
1520 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep
tionState& exceptionState) | 1520 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep
tionState& exceptionState) |
1521 { | 1521 { |
1522 ASSERT(element1 && element2); | 1522 ASSERT(element1 && element2); |
1523 element1->document().view()->updateLayoutAndStyleForPainting(); | 1523 element1->document().view()->updateLayoutAndStyleForPainting(); |
1524 | 1524 |
1525 LayoutObject* renderer1 = element1->renderer(); | 1525 LayoutObject* renderer1 = element1->renderer(); |
1526 LayoutObject* renderer2 = element2->renderer(); | 1526 LayoutObject* renderer2 = element2->renderer(); |
1527 if (!renderer1 || !renderer1->isBox()) { | 1527 if (!renderer1 || !renderer1->isBox()) { |
1528 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi
rst provided element's renderer is not a box." : "The first provided element has
no renderer."); | 1528 exceptionState.throwDOMException(InvalidAccessError, renderer1 ? "The fi
rst provided element's renderer is not a box." : "The first provided element has
no renderer."); |
1529 return 0; | 1529 return false; |
1530 } | 1530 } |
1531 if (!renderer2 || !renderer2->isBox()) { | 1531 if (!renderer2 || !renderer2->isBox()) { |
1532 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se
cond provided element's renderer is not a box." : "The second provided element h
as no renderer."); | 1532 exceptionState.throwDOMException(InvalidAccessError, renderer2 ? "The se
cond provided element's renderer is not a box." : "The second provided element h
as no renderer."); |
1533 return 0; | 1533 return false; |
1534 } | 1534 } |
1535 | 1535 |
1536 Layer* layer1 = toRenderBox(renderer1)->layer(); | 1536 Layer* layer1 = toRenderBox(renderer1)->layer(); |
1537 Layer* layer2 = toRenderBox(renderer2)->layer(); | 1537 Layer* layer2 = toRenderBox(renderer2)->layer(); |
1538 if (!layer1 || !layer2) { | 1538 if (!layer1 || !layer2) { |
1539 exceptionState.throwDOMException(InvalidAccessError, String::format("No
render layer can be obtained from the %s provided element.", layer1 ? "second" :
"first")); | 1539 exceptionState.throwDOMException(InvalidAccessError, String::format("No
render layer can be obtained from the %s provided element.", layer1 ? "second" :
"first")); |
1540 return 0; | 1540 return false; |
1541 } | 1541 } |
1542 | 1542 |
1543 return layer1->scrollsWithRespectTo(layer2); | 1543 return layer1->scrollsWithRespectTo(layer2); |
1544 } | 1544 } |
1545 | 1545 |
1546 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS
tate& exceptionState) const | 1546 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS
tate& exceptionState) const |
1547 { | 1547 { |
1548 ASSERT(document); | 1548 ASSERT(document); |
1549 if (!document->frame()) { | 1549 if (!document->frame()) { |
1550 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1550 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 { | 2336 { |
2337 ThreadState::current()->schedulePreciseGC(); | 2337 ThreadState::current()->schedulePreciseGC(); |
2338 } | 2338 } |
2339 | 2339 |
2340 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) | 2340 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) |
2341 { | 2341 { |
2342 return new InternalsIterationSource(); | 2342 return new InternalsIterationSource(); |
2343 } | 2343 } |
2344 | 2344 |
2345 } // namespace blink | 2345 } // namespace blink |
OLD | NEW |