| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "bindings/core/v8/ExceptionMessages.h" | 32 #include "bindings/core/v8/ExceptionMessages.h" |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/ScriptFunction.h" | 34 #include "bindings/core/v8/ScriptFunction.h" |
| 35 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
| 36 #include "bindings/core/v8/ScriptPromiseResolver.h" | 36 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 37 #include "bindings/core/v8/V8IteratorResultValue.h" | 37 #include "bindings/core/v8/V8IteratorResultValue.h" |
| 38 #include "core/HTMLNames.h" | 38 #include "core/HTMLNames.h" |
| 39 #include "core/SVGNames.h" | 39 #include "core/SVGNames.h" |
| 40 #include "core/animation/DocumentTimeline.h" | 40 #include "core/animation/DocumentTimeline.h" |
| 41 #include "core/dom/ClientRect.h" | |
| 42 #include "core/dom/ClientRectList.h" | 41 #include "core/dom/ClientRectList.h" |
| 43 #include "core/dom/DOMArrayBuffer.h" | 42 #include "core/dom/DOMArrayBuffer.h" |
| 44 #include "core/dom/DOMNodeIds.h" | 43 #include "core/dom/DOMNodeIds.h" |
| 45 #include "core/dom/DOMStringList.h" | 44 #include "core/dom/DOMStringList.h" |
| 46 #include "core/dom/Document.h" | 45 #include "core/dom/Document.h" |
| 47 #include "core/dom/Element.h" | 46 #include "core/dom/Element.h" |
| 48 #include "core/dom/ExceptionCode.h" | 47 #include "core/dom/ExceptionCode.h" |
| 49 #include "core/dom/Iterator.h" | 48 #include "core/dom/Iterator.h" |
| 50 #include "core/dom/NodeComputedStyle.h" | 49 #include "core/dom/NodeComputedStyle.h" |
| 51 #include "core/dom/PseudoElement.h" | 50 #include "core/dom/PseudoElement.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 72 #include "core/editing/spellcheck/SpellCheckRequester.h" | 71 #include "core/editing/spellcheck/SpellCheckRequester.h" |
| 73 #include "core/editing/spellcheck/SpellChecker.h" | 72 #include "core/editing/spellcheck/SpellChecker.h" |
| 74 #include "core/frame/EventHandlerRegistry.h" | 73 #include "core/frame/EventHandlerRegistry.h" |
| 75 #include "core/frame/FrameConsole.h" | 74 #include "core/frame/FrameConsole.h" |
| 76 #include "core/frame/LocalDOMWindow.h" | 75 #include "core/frame/LocalDOMWindow.h" |
| 77 #include "core/frame/LocalFrame.h" | 76 #include "core/frame/LocalFrame.h" |
| 78 #include "core/frame/LocalFrameView.h" | 77 #include "core/frame/LocalFrameView.h" |
| 79 #include "core/frame/Settings.h" | 78 #include "core/frame/Settings.h" |
| 80 #include "core/frame/VisualViewport.h" | 79 #include "core/frame/VisualViewport.h" |
| 81 #include "core/geometry/DOMPoint.h" | 80 #include "core/geometry/DOMPoint.h" |
| 81 #include "core/geometry/DOMRect.h" |
| 82 #include "core/html/HTMLContentElement.h" | 82 #include "core/html/HTMLContentElement.h" |
| 83 #include "core/html/HTMLIFrameElement.h" | 83 #include "core/html/HTMLIFrameElement.h" |
| 84 #include "core/html/HTMLImageElement.h" | 84 #include "core/html/HTMLImageElement.h" |
| 85 #include "core/html/HTMLInputElement.h" | 85 #include "core/html/HTMLInputElement.h" |
| 86 #include "core/html/HTMLMediaElement.h" | 86 #include "core/html/HTMLMediaElement.h" |
| 87 #include "core/html/HTMLSelectElement.h" | 87 #include "core/html/HTMLSelectElement.h" |
| 88 #include "core/html/HTMLTextAreaElement.h" | 88 #include "core/html/HTMLTextAreaElement.h" |
| 89 #include "core/html/HTMLVideoElement.h" | 89 #include "core/html/HTMLVideoElement.h" |
| 90 #include "core/html/canvas/CanvasFontCache.h" | 90 #include "core/html/canvas/CanvasFontCache.h" |
| 91 #include "core/html/canvas/CanvasRenderingContext.h" | 91 #include "core/html/canvas/CanvasRenderingContext.h" |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 ToLocalDOMWindow(page->GetChromeClient().PagePopupWindowForTesting()); | 862 ToLocalDOMWindow(page->GetChromeClient().PagePopupWindowForTesting()); |
| 863 if (popup) { | 863 if (popup) { |
| 864 // We need to make the popup same origin so layout tests can access it. | 864 // We need to make the popup same origin so layout tests can access it. |
| 865 popup->document()->UpdateSecurityOrigin(document_->GetSecurityOrigin()); | 865 popup->document()->UpdateSecurityOrigin(document_->GetSecurityOrigin()); |
| 866 } | 866 } |
| 867 return popup; | 867 return popup; |
| 868 } | 868 } |
| 869 return nullptr; | 869 return nullptr; |
| 870 } | 870 } |
| 871 | 871 |
| 872 ClientRect* Internals::absoluteCaretBounds(ExceptionState& exception_state) { | 872 DOMRect* Internals::absoluteCaretBounds(ExceptionState& exception_state) { |
| 873 if (!GetFrame()) { | 873 if (!GetFrame()) { |
| 874 exception_state.ThrowDOMException( | 874 exception_state.ThrowDOMException( |
| 875 kInvalidAccessError, "The document's frame cannot be retrieved."); | 875 kInvalidAccessError, "The document's frame cannot be retrieved."); |
| 876 return ClientRect::Create(); | 876 return DOMRect::Create(); |
| 877 } | 877 } |
| 878 | 878 |
| 879 document_->UpdateStyleAndLayoutIgnorePendingStylesheets(); | 879 document_->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 880 return ClientRect::Create(GetFrame()->Selection().AbsoluteCaretBounds()); | 880 return DOMRect::Create(GetFrame()->Selection().AbsoluteCaretBounds()); |
| 881 } | 881 } |
| 882 | 882 |
| 883 String Internals::textAffinity() { | 883 String Internals::textAffinity() { |
| 884 if (GetFrame() | 884 if (GetFrame() |
| 885 ->GetPage() | 885 ->GetPage() |
| 886 ->GetFocusController() | 886 ->GetFocusController() |
| 887 .FocusedFrame() | 887 .FocusedFrame() |
| 888 ->Selection() | 888 ->Selection() |
| 889 .GetSelectionInDOMTree() | 889 .GetSelectionInDOMTree() |
| 890 .Affinity() == TextAffinity::kUpstream) { | 890 .Affinity() == TextAffinity::kUpstream) { |
| 891 return "Upstream"; | 891 return "Upstream"; |
| 892 } | 892 } |
| 893 return "Downstream"; | 893 return "Downstream"; |
| 894 } | 894 } |
| 895 | 895 |
| 896 ClientRect* Internals::boundingBox(Element* element) { | 896 DOMRect* Internals::boundingBox(Element* element) { |
| 897 DCHECK(element); | 897 DCHECK(element); |
| 898 | 898 |
| 899 element->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 899 element->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 900 LayoutObject* layout_object = element->GetLayoutObject(); | 900 LayoutObject* layout_object = element->GetLayoutObject(); |
| 901 if (!layout_object) | 901 if (!layout_object) |
| 902 return ClientRect::Create(); | 902 return DOMRect::Create(); |
| 903 return ClientRect::Create( | 903 return DOMRect::Create( |
| 904 layout_object->AbsoluteBoundingBoxRectIgnoringTransforms()); | 904 layout_object->AbsoluteBoundingBoxRectIgnoringTransforms()); |
| 905 } | 905 } |
| 906 | 906 |
| 907 void Internals::setMarker(Document* document, | 907 void Internals::setMarker(Document* document, |
| 908 const Range* range, | 908 const Range* range, |
| 909 const String& marker_type, | 909 const String& marker_type, |
| 910 ExceptionState& exception_state) { | 910 ExceptionState& exception_state) { |
| 911 if (!document) { | 911 if (!document) { |
| 912 exception_state.ThrowDOMException(kInvalidAccessError, | 912 exception_state.ThrowDOMException(kInvalidAccessError, |
| 913 "No context document is available."); | 913 "No context document is available."); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 HitTestRequest::kListBased, | 1493 HitTestRequest::kListBased, |
| 1494 LayoutSize(radius)); | 1494 LayoutSize(radius)); |
| 1495 | 1495 |
| 1496 Node* target_node = 0; | 1496 Node* target_node = 0; |
| 1497 IntPoint adjusted_point; | 1497 IntPoint adjusted_point; |
| 1498 event_handler.BestContextMenuNodeForHitTestResult(result, adjusted_point, | 1498 event_handler.BestContextMenuNodeForHitTestResult(result, adjusted_point, |
| 1499 target_node); | 1499 target_node); |
| 1500 return target_node; | 1500 return target_node; |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 ClientRect* Internals::bestZoomableAreaForTouchPoint( | 1503 DOMRect* Internals::bestZoomableAreaForTouchPoint( |
| 1504 long x, | 1504 long x, |
| 1505 long y, | 1505 long y, |
| 1506 long width, | 1506 long width, |
| 1507 long height, | 1507 long height, |
| 1508 Document* document, | 1508 Document* document, |
| 1509 ExceptionState& exception_state) { | 1509 ExceptionState& exception_state) { |
| 1510 DCHECK(document); | 1510 DCHECK(document); |
| 1511 if (!document->GetFrame()) { | 1511 if (!document->GetFrame()) { |
| 1512 exception_state.ThrowDOMException(kInvalidAccessError, | 1512 exception_state.ThrowDOMException(kInvalidAccessError, |
| 1513 "The document provided is invalid."); | 1513 "The document provided is invalid."); |
| 1514 return nullptr; | 1514 return nullptr; |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 document->UpdateStyleAndLayout(); | 1517 document->UpdateStyleAndLayout(); |
| 1518 | 1518 |
| 1519 IntSize radius(width / 2, height / 2); | 1519 IntSize radius(width / 2, height / 2); |
| 1520 IntPoint point(x + radius.Width(), y + radius.Height()); | 1520 IntPoint point(x + radius.Width(), y + radius.Height()); |
| 1521 | 1521 |
| 1522 Node* target_node = 0; | 1522 Node* target_node = 0; |
| 1523 IntRect zoomable_area; | 1523 IntRect zoomable_area; |
| 1524 bool found_node = | 1524 bool found_node = |
| 1525 document->GetFrame()->GetEventHandler().BestZoomableAreaForTouchPoint( | 1525 document->GetFrame()->GetEventHandler().BestZoomableAreaForTouchPoint( |
| 1526 point, radius, zoomable_area, target_node); | 1526 point, radius, zoomable_area, target_node); |
| 1527 if (found_node) | 1527 if (found_node) |
| 1528 return ClientRect::Create(zoomable_area); | 1528 return DOMRect::Create(zoomable_area); |
| 1529 | 1529 |
| 1530 return nullptr; | 1530 return nullptr; |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 int Internals::lastSpellCheckRequestSequence(Document* document, | 1533 int Internals::lastSpellCheckRequestSequence(Document* document, |
| 1534 ExceptionState& exception_state) { | 1534 ExceptionState& exception_state) { |
| 1535 SpellCheckRequester* requester = GetSpellCheckRequester(document); | 1535 SpellCheckRequester* requester = GetSpellCheckRequester(document); |
| 1536 | 1536 |
| 1537 if (!requester) { | 1537 if (!requester) { |
| 1538 exception_state.ThrowDOMException( | 1538 exception_state.ThrowDOMException( |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 if (!layer_rects.empty()) { | 1842 if (!layer_rects.empty()) { |
| 1843 MergeRects(layer_rects); | 1843 MergeRects(layer_rects); |
| 1844 String layer_type; | 1844 String layer_type; |
| 1845 IntSize layer_offset; | 1845 IntSize layer_offset; |
| 1846 PaintLayer* paint_layer = FindLayerForGraphicsLayer( | 1846 PaintLayer* paint_layer = FindLayerForGraphicsLayer( |
| 1847 compositor->RootLayer(), graphics_layer, &layer_offset, &layer_type); | 1847 compositor->RootLayer(), graphics_layer, &layer_offset, &layer_type); |
| 1848 Node* node = paint_layer ? paint_layer->GetLayoutObject().GetNode() : 0; | 1848 Node* node = paint_layer ? paint_layer->GetLayoutObject().GetNode() : 0; |
| 1849 for (size_t i = 0; i < layer_rects.size(); ++i) { | 1849 for (size_t i = 0; i < layer_rects.size(); ++i) { |
| 1850 if (!layer_rects[i].IsEmpty()) { | 1850 if (!layer_rects[i].IsEmpty()) { |
| 1851 rects->Append(node, layer_type, layer_offset.Width(), | 1851 rects->Append(node, layer_type, layer_offset.Width(), |
| 1852 layer_offset.Height(), | 1852 layer_offset.Height(), DOMRect::Create(layer_rects[i])); |
| 1853 ClientRect::Create(layer_rects[i])); | |
| 1854 } | 1853 } |
| 1855 } | 1854 } |
| 1856 } | 1855 } |
| 1857 | 1856 |
| 1858 size_t num_children = graphics_layer->Children().size(); | 1857 size_t num_children = graphics_layer->Children().size(); |
| 1859 for (size_t i = 0; i < num_children; ++i) | 1858 for (size_t i = 0; i < num_children; ++i) |
| 1860 AccumulateLayerRectList(compositor, graphics_layer->Children()[i], rects); | 1859 AccumulateLayerRectList(compositor, graphics_layer->Children()[i], rects); |
| 1861 } | 1860 } |
| 1862 | 1861 |
| 1863 LayerRectList* Internals::touchEventTargetLayerRects( | 1862 LayerRectList* Internals::touchEventTargetLayerRects( |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 unsigned Internals::visibleSelectionFocusOffset() { | 2837 unsigned Internals::visibleSelectionFocusOffset() { |
| 2839 if (!GetFrame()) | 2838 if (!GetFrame()) |
| 2840 return 0; | 2839 return 0; |
| 2841 Position position = GetFrame() | 2840 Position position = GetFrame() |
| 2842 ->Selection() | 2841 ->Selection() |
| 2843 .ComputeVisibleSelectionInDOMTreeDeprecated() | 2842 .ComputeVisibleSelectionInDOMTreeDeprecated() |
| 2844 .Extent(); | 2843 .Extent(); |
| 2845 return position.IsNull() ? 0 : position.ComputeOffsetInContainerNode(); | 2844 return position.IsNull() ? 0 : position.ComputeOffsetInContainerNode(); |
| 2846 } | 2845 } |
| 2847 | 2846 |
| 2848 ClientRect* Internals::selectionBounds(ExceptionState& exception_state) { | 2847 DOMRect* Internals::selectionBounds(ExceptionState& exception_state) { |
| 2849 if (!GetFrame()) { | 2848 if (!GetFrame()) { |
| 2850 exception_state.ThrowDOMException( | 2849 exception_state.ThrowDOMException( |
| 2851 kInvalidAccessError, "The document's frame cannot be retrieved."); | 2850 kInvalidAccessError, "The document's frame cannot be retrieved."); |
| 2852 return nullptr; | 2851 return nullptr; |
| 2853 } | 2852 } |
| 2854 | 2853 |
| 2855 return ClientRect::Create(FloatRect(GetFrame()->Selection().Bounds())); | 2854 return DOMRect::Create(FloatRect(GetFrame()->Selection().Bounds())); |
| 2856 } | 2855 } |
| 2857 | 2856 |
| 2858 String Internals::markerTextForListItem(Element* element) { | 2857 String Internals::markerTextForListItem(Element* element) { |
| 2859 DCHECK(element); | 2858 DCHECK(element); |
| 2860 return blink::MarkerTextForListItem(element); | 2859 return blink::MarkerTextForListItem(element); |
| 2861 } | 2860 } |
| 2862 | 2861 |
| 2863 String Internals::getImageSourceURL(Element* element) { | 2862 String Internals::getImageSourceURL(Element* element) { |
| 2864 DCHECK(element); | 2863 DCHECK(element); |
| 2865 return element->ImageSourceURL(); | 2864 return element->ImageSourceURL(); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3375 return scrollable_area->GetScrollAnimator().RunStateAsText(); | 3374 return scrollable_area->GetScrollAnimator().RunStateAsText(); |
| 3376 return String(); | 3375 return String(); |
| 3377 } | 3376 } |
| 3378 | 3377 |
| 3379 String Internals::getProgrammaticScrollAnimationState(Node* node) const { | 3378 String Internals::getProgrammaticScrollAnimationState(Node* node) const { |
| 3380 if (ScrollableArea* scrollable_area = ScrollableAreaForNode(node)) | 3379 if (ScrollableArea* scrollable_area = ScrollableAreaForNode(node)) |
| 3381 return scrollable_area->GetProgrammaticScrollAnimator().RunStateAsText(); | 3380 return scrollable_area->GetProgrammaticScrollAnimator().RunStateAsText(); |
| 3382 return String(); | 3381 return String(); |
| 3383 } | 3382 } |
| 3384 | 3383 |
| 3385 ClientRect* Internals::visualRect(Node* node) { | 3384 DOMRect* Internals::visualRect(Node* node) { |
| 3386 if (!node || !node->GetLayoutObject()) | 3385 if (!node || !node->GetLayoutObject()) |
| 3387 return ClientRect::Create(); | 3386 return DOMRect::Create(); |
| 3388 | 3387 |
| 3389 return ClientRect::Create(FloatRect(node->GetLayoutObject()->VisualRect())); | 3388 return DOMRect::Create(FloatRect(node->GetLayoutObject()->VisualRect())); |
| 3390 } | 3389 } |
| 3391 | 3390 |
| 3392 void Internals::crash() { | 3391 void Internals::crash() { |
| 3393 CHECK(false) << "Intentional crash"; | 3392 CHECK(false) << "Intentional crash"; |
| 3394 } | 3393 } |
| 3395 | 3394 |
| 3396 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3395 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3397 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3396 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3398 } | 3397 } |
| 3399 | 3398 |
| 3400 } // namespace blink | 3399 } // namespace blink |
| OLD | NEW |