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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 DOMWindow* Internals::pagePopupWindow() const | 660 DOMWindow* Internals::pagePopupWindow() const |
661 { | 661 { |
662 Document* document = contextDocument(); | 662 Document* document = contextDocument(); |
663 if (!document) | 663 if (!document) |
664 return nullptr; | 664 return nullptr; |
665 if (Page* page = document->page()) | 665 if (Page* page = document->page()) |
666 return page->chrome().client().pagePopupWindowForTesting(); | 666 return page->chrome().client().pagePopupWindowForTesting(); |
667 return nullptr; | 667 return nullptr; |
668 } | 668 } |
669 | 669 |
670 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState
& exceptionState) | 670 ClientRect* Internals::absoluteCaretBounds(ExceptionState& exceptionState) |
671 { | 671 { |
672 Document* document = contextDocument(); | 672 Document* document = contextDocument(); |
673 if (!document || !document->frame()) { | 673 if (!document || !document->frame()) { |
674 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); | 674 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); |
675 return ClientRect::create(); | 675 return ClientRect::create(); |
676 } | 676 } |
677 | 677 |
678 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); | 678 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); |
679 } | 679 } |
680 | 680 |
681 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundingBox(Element* element) | 681 ClientRect* Internals::boundingBox(Element* element) |
682 { | 682 { |
683 ASSERT(element); | 683 ASSERT(element); |
684 | 684 |
685 element->document().updateLayoutIgnorePendingStylesheets(); | 685 element->document().updateLayoutIgnorePendingStylesheets(); |
686 LayoutObject* renderer = element->layoutObject(); | 686 LayoutObject* renderer = element->layoutObject(); |
687 if (!renderer) | 687 if (!renderer) |
688 return ClientRect::create(); | 688 return ClientRect::create(); |
689 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform
s()); | 689 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform
s()); |
690 } | 690 } |
691 | 691 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 EventHandler& eventHandler = document->frame()->eventHandler(); | 1056 EventHandler& eventHandler = document->frame()->eventHandler(); |
1057 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); | 1057 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); |
1058 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); | 1058 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
1059 | 1059 |
1060 Node* targetNode = 0; | 1060 Node* targetNode = 0; |
1061 IntPoint adjustedPoint; | 1061 IntPoint adjustedPoint; |
1062 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); | 1062 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); |
1063 return targetNode; | 1063 return targetNode; |
1064 } | 1064 } |
1065 | 1065 |
1066 PassRefPtrWillBeRawPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long
x, long y, long width, long height, Document* document, ExceptionState& excepti
onState) | 1066 ClientRect* Internals::bestZoomableAreaForTouchPoint(long x, long y, long width,
long height, Document* document, ExceptionState& exceptionState) |
1067 { | 1067 { |
1068 ASSERT(document); | 1068 ASSERT(document); |
1069 if (!document->frame()) { | 1069 if (!document->frame()) { |
1070 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1070 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1071 return nullptr; | 1071 return nullptr; |
1072 } | 1072 } |
1073 | 1073 |
1074 document->updateLayout(); | 1074 document->updateLayout(); |
1075 | 1075 |
1076 IntSize radius(width / 2, height / 2); | 1076 IntSize radius(width / 2, height / 2); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 | 1577 |
1578 document->frame()->view()->updateLayoutAndStyleForPainting(); | 1578 document->frame()->view()->updateLayoutAndStyleForPainting(); |
1579 | 1579 |
1580 Page* page = document->page(); | 1580 Page* page = document->page(); |
1581 if (!page) | 1581 if (!page) |
1582 return String(); | 1582 return String(); |
1583 | 1583 |
1584 return page->mainThreadScrollingReasonsAsText(); | 1584 return page->mainThreadScrollingReasonsAsText(); |
1585 } | 1585 } |
1586 | 1586 |
1587 PassRefPtrWillBeRawPtr<ClientRectList> Internals::nonFastScrollableRects(Documen
t* document, ExceptionState& exceptionState) const | 1587 ClientRectList* Internals::nonFastScrollableRects(Document* document, ExceptionS
tate& exceptionState) const |
1588 { | 1588 { |
1589 ASSERT(document); | 1589 ASSERT(document); |
1590 if (!document->frame()) { | 1590 if (!document->frame()) { |
1591 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1591 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1592 return nullptr; | 1592 return nullptr; |
1593 } | 1593 } |
1594 | 1594 |
1595 Page* page = document->page(); | 1595 Page* page = document->page(); |
1596 if (!page) | 1596 if (!page) |
1597 return nullptr; | 1597 return nullptr; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 ASSERT(document); | 1821 ASSERT(document); |
1822 if (!document->view()) { | 1822 if (!document->view()) { |
1823 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1823 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1824 return; | 1824 return; |
1825 } | 1825 } |
1826 | 1826 |
1827 if (LayoutView *layoutView = document->layoutView()) | 1827 if (LayoutView *layoutView = document->layoutView()) |
1828 layoutView->invalidatePaintForViewAndCompositedLayers(); | 1828 layoutView->invalidatePaintForViewAndCompositedLayers(); |
1829 } | 1829 } |
1830 | 1830 |
1831 PassRefPtrWillBeRawPtr<ClientRectList> Internals::draggableRegions(Document* doc
ument, ExceptionState& exceptionState) | 1831 ClientRectList* Internals::draggableRegions(Document* document, ExceptionState&
exceptionState) |
1832 { | 1832 { |
1833 return annotatedRegions(document, true, exceptionState); | 1833 return annotatedRegions(document, true, exceptionState); |
1834 } | 1834 } |
1835 | 1835 |
1836 PassRefPtrWillBeRawPtr<ClientRectList> Internals::nonDraggableRegions(Document*
document, ExceptionState& exceptionState) | 1836 ClientRectList* Internals::nonDraggableRegions(Document* document, ExceptionStat
e& exceptionState) |
1837 { | 1837 { |
1838 return annotatedRegions(document, false, exceptionState); | 1838 return annotatedRegions(document, false, exceptionState); |
1839 } | 1839 } |
1840 | 1840 |
1841 PassRefPtrWillBeRawPtr<ClientRectList> Internals::annotatedRegions(Document* doc
ument, bool draggable, ExceptionState& exceptionState) | 1841 ClientRectList* Internals::annotatedRegions(Document* document, bool draggable,
ExceptionState& exceptionState) |
1842 { | 1842 { |
1843 ASSERT(document); | 1843 ASSERT(document); |
1844 if (!document->view()) { | 1844 if (!document->view()) { |
1845 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1845 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1846 return ClientRectList::create(); | 1846 return ClientRectList::create(); |
1847 } | 1847 } |
1848 | 1848 |
1849 document->updateLayout(); | 1849 document->updateLayout(); |
1850 document->view()->updateAnnotatedRegions(); | 1850 document->view()->updateAnnotatedRegions(); |
1851 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); | 1851 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 { | 1956 { |
1957 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength()
/ sizeof(UChar)); | 1957 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength()
/ sizeof(UChar)); |
1958 return SerializedScriptValueFactory::instance().createFromWire(value); | 1958 return SerializedScriptValueFactory::instance().createFromWire(value); |
1959 } | 1959 } |
1960 | 1960 |
1961 void Internals::forceReload(bool endToEnd) | 1961 void Internals::forceReload(bool endToEnd) |
1962 { | 1962 { |
1963 frame()->reload(endToEnd ? EndToEndReload : NormalReload, NotClientRedirect)
; | 1963 frame()->reload(endToEnd ? EndToEndReload : NormalReload, NotClientRedirect)
; |
1964 } | 1964 } |
1965 | 1965 |
1966 PassRefPtrWillBeRawPtr<ClientRect> Internals::selectionBounds(ExceptionState& ex
ceptionState) | 1966 ClientRect* Internals::selectionBounds(ExceptionState& exceptionState) |
1967 { | 1967 { |
1968 Document* document = contextDocument(); | 1968 Document* document = contextDocument(); |
1969 if (!document || !document->frame()) { | 1969 if (!document || !document->frame()) { |
1970 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); | 1970 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); |
1971 return nullptr; | 1971 return nullptr; |
1972 } | 1972 } |
1973 | 1973 |
1974 return ClientRect::create(document->frame()->selection().bounds()); | 1974 return ClientRect::create(document->frame()->selection().bounds()); |
1975 } | 1975 } |
1976 | 1976 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 return; | 2231 return; |
2232 } | 2232 } |
2233 networkStateNotifier().setWebConnectionTypeForTest(webtype); | 2233 networkStateNotifier().setWebConnectionTypeForTest(webtype); |
2234 } | 2234 } |
2235 | 2235 |
2236 unsigned Internals::countHitRegions(CanvasRenderingContext2D* context) | 2236 unsigned Internals::countHitRegions(CanvasRenderingContext2D* context) |
2237 { | 2237 { |
2238 return context->hitRegionsCount(); | 2238 return context->hitRegionsCount(); |
2239 } | 2239 } |
2240 | 2240 |
2241 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundsInViewportSpace(Element* ele
ment) | 2241 ClientRect* Internals::boundsInViewportSpace(Element* element) |
2242 { | 2242 { |
2243 ASSERT(element); | 2243 ASSERT(element); |
2244 return ClientRect::create(element->boundsInViewportSpace()); | 2244 return ClientRect::create(element->boundsInViewportSpace()); |
2245 } | 2245 } |
2246 | 2246 |
2247 String Internals::serializeNavigationMarkup() | 2247 String Internals::serializeNavigationMarkup() |
2248 { | 2248 { |
2249 Vector<Document::TransitionElementData> elementData; | 2249 Vector<Document::TransitionElementData> elementData; |
2250 frame()->document()->getTransitionElementData(elementData); | 2250 frame()->document()->getTransitionElementData(elementData); |
2251 | 2251 |
(...skipping 11 matching lines...) Expand all Loading... |
2263 | 2263 |
2264 Vector<String> ids; | 2264 Vector<String> ids; |
2265 for (size_t i = 0; i < elementData.size(); ++i) { | 2265 for (size_t i = 0; i < elementData.size(); ++i) { |
2266 for (size_t j = 0; j < elementData[i].elements.size(); ++j) | 2266 for (size_t j = 0; j < elementData[i].elements.size(); ++j) |
2267 ids.append(elementData[i].elements[j].id); | 2267 ids.append(elementData[i].elements[j].id); |
2268 } | 2268 } |
2269 | 2269 |
2270 return ids; | 2270 return ids; |
2271 } | 2271 } |
2272 | 2272 |
2273 PassRefPtrWillBeRawPtr<ClientRectList> Internals::getTransitionElementRects() | 2273 ClientRectList* Internals::getTransitionElementRects() |
2274 { | 2274 { |
2275 Vector<Document::TransitionElementData> elementData; | 2275 Vector<Document::TransitionElementData> elementData; |
2276 frame()->document()->getTransitionElementData(elementData); | 2276 frame()->document()->getTransitionElementData(elementData); |
2277 | 2277 |
2278 Vector<IntRect> rects; | 2278 Vector<IntRect> rects; |
2279 for (size_t i = 0; i < elementData.size(); ++i) { | 2279 for (size_t i = 0; i < elementData.size(); ++i) { |
2280 for (size_t j = 0; j < elementData[i].elements.size(); ++j) | 2280 for (size_t j = 0; j < elementData[i].elements.size(); ++j) |
2281 rects.append(elementData[i].elements[j].rect); | 2281 rects.append(elementData[i].elements[j].rect); |
2282 } | 2282 } |
2283 return ClientRectList::create(rects); | 2283 return ClientRectList::create(rects); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 { | 2358 { |
2359 return "unscopeableAttribute"; | 2359 return "unscopeableAttribute"; |
2360 } | 2360 } |
2361 | 2361 |
2362 String Internals::unscopeableMethod() | 2362 String Internals::unscopeableMethod() |
2363 { | 2363 { |
2364 return "unscopeableMethod"; | 2364 return "unscopeableMethod"; |
2365 } | 2365 } |
2366 | 2366 |
2367 } // namespace blink | 2367 } // namespace blink |
OLD | NEW |