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