| 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 ASSERT(element); | 650 ASSERT(element); |
| 651 String representation = externalRepresentation(element); | 651 String representation = externalRepresentation(element); |
| 652 if (representation.isEmpty()) { | 652 if (representation.isEmpty()) { |
| 653 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed has no external representation."); | 653 exceptionState.throwDOMException(InvalidAccessError, "The element provid
ed has no external representation."); |
| 654 return String(); | 654 return String(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 return representation; | 657 return representation; |
| 658 } | 658 } |
| 659 | 659 |
| 660 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> Internals::computedStyleIncludingVis
itedInfo(Node* node) const | 660 RawPtr<CSSStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node* n
ode) const |
| 661 { | 661 { |
| 662 ASSERT(node); | 662 ASSERT(node); |
| 663 bool allowVisitedStyle = true; | 663 bool allowVisitedStyle = true; |
| 664 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); | 664 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); |
| 665 } | 665 } |
| 666 | 666 |
| 667 PassRefPtrWillBeRawPtr<ShadowRoot> Internals::createUserAgentShadowRoot(Element*
host) | 667 RawPtr<ShadowRoot> Internals::createUserAgentShadowRoot(Element* host) |
| 668 { | 668 { |
| 669 ASSERT(host); | 669 ASSERT(host); |
| 670 return PassRefPtrWillBeRawPtr<ShadowRoot>(host->ensureUserAgentShadowRoot())
; | 670 return RawPtr<ShadowRoot>(host->ensureUserAgentShadowRoot()); |
| 671 } | 671 } |
| 672 | 672 |
| 673 ShadowRoot* Internals::shadowRoot(Element* host) | 673 ShadowRoot* Internals::shadowRoot(Element* host) |
| 674 { | 674 { |
| 675 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). | 675 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). |
| 676 // https://bugs.webkit.org/show_bug.cgi?id=78465 | 676 // https://bugs.webkit.org/show_bug.cgi?id=78465 |
| 677 return youngestShadowRoot(host); | 677 return youngestShadowRoot(host); |
| 678 } | 678 } |
| 679 | 679 |
| 680 ShadowRoot* Internals::youngestShadowRoot(Element* host) | 680 ShadowRoot* Internals::youngestShadowRoot(Element* host) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 exceptionState.throwDOMException(SyntaxError, "The marker type provided
('" + markerType + "') is invalid."); | 867 exceptionState.throwDOMException(SyntaxError, "The marker type provided
('" + markerType + "') is invalid."); |
| 868 return 0; | 868 return 0; |
| 869 } | 869 } |
| 870 | 870 |
| 871 DocumentMarkerVector markers = node->document().markers().markersFor(node, m
arkerTypes); | 871 DocumentMarkerVector markers = node->document().markers().markersFor(node, m
arkerTypes); |
| 872 if (markers.size() <= index) | 872 if (markers.size() <= index) |
| 873 return 0; | 873 return 0; |
| 874 return markers[index]; | 874 return markers[index]; |
| 875 } | 875 } |
| 876 | 876 |
| 877 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St
ring& markerType, unsigned index, ExceptionState& exceptionState) | 877 RawPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType
, unsigned index, ExceptionState& exceptionState) |
| 878 { | 878 { |
| 879 ASSERT(node); | 879 ASSERT(node); |
| 880 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); | 880 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); |
| 881 if (!marker) | 881 if (!marker) |
| 882 return nullptr; | 882 return nullptr; |
| 883 return Range::create(node->document(), node, marker->startOffset(), node, ma
rker->endOffset()); | 883 return Range::create(node->document(), node, marker->startOffset(), node, ma
rker->endOffset()); |
| 884 } | 884 } |
| 885 | 885 |
| 886 String Internals::markerDescriptionForNode(Node* node, const String& markerType,
unsigned index, ExceptionState& exceptionState) | 886 String Internals::markerDescriptionForNode(Node* node, const String& markerType,
unsigned index, ExceptionState& exceptionState) |
| 887 { | 887 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& ex
ceptionState) | 1033 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& ex
ceptionState) |
| 1034 { | 1034 { |
| 1035 ASSERT(element); | 1035 ASSERT(element); |
| 1036 if (!element->isFormControlElement()) { | 1036 if (!element->isFormControlElement()) { |
| 1037 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov
ided is not a form control element."); | 1037 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov
ided is not a form control element."); |
| 1038 return; | 1038 return; |
| 1039 } | 1039 } |
| 1040 toHTMLFormControlElement(element)->setAutofilled(enabled); | 1040 toHTMLFormControlElement(element)->setAutofilled(enabled); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 PassRefPtrWillBeRawPtr<Range> Internals::rangeFromLocationAndLength(Element* sco
pe, int rangeLocation, int rangeLength) | 1043 RawPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLoc
ation, int rangeLength) |
| 1044 { | 1044 { |
| 1045 ASSERT(scope); | 1045 ASSERT(scope); |
| 1046 | 1046 |
| 1047 // TextIterator depends on Layout information, make sure layout it up to dat
e. | 1047 // TextIterator depends on Layout information, make sure layout it up to dat
e. |
| 1048 scope->document().updateLayoutIgnorePendingStylesheets(); | 1048 scope->document().updateLayoutIgnorePendingStylesheets(); |
| 1049 | 1049 |
| 1050 return createRange(PlainTextRange(rangeLocation, rangeLocation + rangeLength
).createRange(*scope)); | 1050 return createRange(PlainTextRange(rangeLocation, rangeLocation + rangeLength
).createRange(*scope)); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 unsigned Internals::locationFromRange(Element* scope, const Range* range) | 1053 unsigned Internals::locationFromRange(Element* scope, const Range* range) |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 | 1479 |
| 1480 Vector<AtomicString> Internals::svgTags() | 1480 Vector<AtomicString> Internals::svgTags() |
| 1481 { | 1481 { |
| 1482 Vector<AtomicString> tags(SVGNames::SVGTagsCount); | 1482 Vector<AtomicString> tags(SVGNames::SVGTagsCount); |
| 1483 OwnPtr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); | 1483 OwnPtr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); |
| 1484 for (size_t i = 0; i < SVGNames::SVGTagsCount; ++i) | 1484 for (size_t i = 0; i < SVGNames::SVGTagsCount; ++i) |
| 1485 tags[i] = qualifiedNames[i]->localName(); | 1485 tags[i] = qualifiedNames[i]->localName(); |
| 1486 return tags; | 1486 return tags; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 PassRefPtrWillBeRawPtr<StaticNodeList> Internals::nodesFromRect(Document* docume
nt, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, | 1489 RawPtr<StaticNodeList> Internals::nodesFromRect(Document* document, int centerX,
int centerY, unsigned topPadding, unsigned rightPadding, |
| 1490 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wChildFrameContent, ExceptionState& exceptionState) const | 1490 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wChildFrameContent, ExceptionState& exceptionState) const |
| 1491 { | 1491 { |
| 1492 ASSERT(document); | 1492 ASSERT(document); |
| 1493 if (!document->frame() || !document->frame()->view()) { | 1493 if (!document->frame() || !document->frame()->view()) { |
| 1494 exceptionState.throwDOMException(InvalidAccessError, "No view can be obt
ained from the provided document."); | 1494 exceptionState.throwDOMException(InvalidAccessError, "No view can be obt
ained from the provided document."); |
| 1495 return nullptr; | 1495 return nullptr; |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 LocalFrame* frame = document->frame(); | 1498 LocalFrame* frame = document->frame(); |
| 1499 FrameView* frameView = document->view(); | 1499 FrameView* frameView = document->view(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1510 hitType |= HitTestRequest::IgnoreClipping; | 1510 hitType |= HitTestRequest::IgnoreClipping; |
| 1511 if (allowChildFrameContent) | 1511 if (allowChildFrameContent) |
| 1512 hitType |= HitTestRequest::AllowChildFrameContent; | 1512 hitType |= HitTestRequest::AllowChildFrameContent; |
| 1513 | 1513 |
| 1514 HitTestRequest request(hitType); | 1514 HitTestRequest request(hitType); |
| 1515 | 1515 |
| 1516 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. | 1516 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. |
| 1517 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) | 1517 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) |
| 1518 return nullptr; | 1518 return nullptr; |
| 1519 | 1519 |
| 1520 WillBeHeapVector<RefPtrWillBeMember<Node>> matches; | 1520 HeapVector<Member<Node>> matches; |
| 1521 HitTestResult result(request, point, topPadding, rightPadding, bottomPadding
, leftPadding); | 1521 HitTestResult result(request, point, topPadding, rightPadding, bottomPadding
, leftPadding); |
| 1522 layoutView->hitTest(result); | 1522 layoutView->hitTest(result); |
| 1523 copyToVector(result.listBasedTestResult(), matches); | 1523 copyToVector(result.listBasedTestResult(), matches); |
| 1524 | 1524 |
| 1525 return StaticNodeList::adopt(matches); | 1525 return StaticNodeList::adopt(matches); |
| 1526 } | 1526 } |
| 1527 | 1527 |
| 1528 bool Internals::hasSpellingMarker(Document* document, int from, int length) | 1528 bool Internals::hasSpellingMarker(Document* document, int from, int length) |
| 1529 { | 1529 { |
| 1530 ASSERT(document); | 1530 ASSERT(document); |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2432 { | 2432 { |
| 2433 return document->canvasFontCache()->isInCache(fontString); | 2433 return document->canvasFontCache()->isInCache(fontString); |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 unsigned Internals::canvasFontCacheMaxFonts() | 2436 unsigned Internals::canvasFontCacheMaxFonts() |
| 2437 { | 2437 { |
| 2438 return CanvasFontCache::maxFonts(); | 2438 return CanvasFontCache::maxFonts(); |
| 2439 } | 2439 } |
| 2440 | 2440 |
| 2441 void Internals::setScrollChain( | 2441 void Internals::setScrollChain( |
| 2442 ScrollState* scrollState, const WillBeHeapVector<RefPtrWillBeMember<Element>
>& elements, ExceptionState&) | 2442 ScrollState* scrollState, const HeapVector<Member<Element>>& elements, Excep
tionState&) |
| 2443 { | 2443 { |
| 2444 std::deque<int> scrollChain; | 2444 std::deque<int> scrollChain; |
| 2445 for (size_t i = 0; i < elements.size(); ++i) | 2445 for (size_t i = 0; i < elements.size(); ++i) |
| 2446 scrollChain.push_back(DOMNodeIds::idForNode(elements[i].get())); | 2446 scrollChain.push_back(DOMNodeIds::idForNode(elements[i].get())); |
| 2447 scrollState->setScrollChain(scrollChain); | 2447 scrollState->setScrollChain(scrollChain); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 void Internals::forceBlinkGCWithoutV8GC() | 2450 void Internals::forceBlinkGCWithoutV8GC() |
| 2451 { | 2451 { |
| 2452 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); | 2452 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 String Internals::getProgrammaticScrollAnimationState(Node* node) const | 2583 String Internals::getProgrammaticScrollAnimationState(Node* node) const |
| 2584 { | 2584 { |
| 2585 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) | 2585 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) |
| 2586 return scrollableArea->programmaticScrollAnimator().runStateAsText(); | 2586 return scrollableArea->programmaticScrollAnimator().runStateAsText(); |
| 2587 return String(); | 2587 return String(); |
| 2588 } | 2588 } |
| 2589 | 2589 |
| 2590 } // namespace blink | 2590 } // namespace blink |
| OLD | NEW |