| 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 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/SerializedScriptValue.h" | 35 #include "bindings/core/v8/SerializedScriptValue.h" |
| 36 #include "bindings/core/v8/V8ThrowException.h" | 36 #include "bindings/core/v8/V8ThrowException.h" |
| 37 #include "core/InternalRuntimeFlags.h" | 37 #include "core/InternalRuntimeFlags.h" |
| 38 #include "core/animation/AnimationTimeline.h" | 38 #include "core/animation/AnimationTimeline.h" |
| 39 #include "core/css/StyleSheetContents.h" | 39 #include "core/css/StyleSheetContents.h" |
| 40 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 41 #include "core/css/resolver/StyleResolverStats.h" | 41 #include "core/css/resolver/StyleResolverStats.h" |
| 42 #include "core/css/resolver/ViewportStyleResolver.h" | 42 #include "core/css/resolver/ViewportStyleResolver.h" |
| 43 #include "core/dom/ClientRect.h" | 43 #include "core/dom/ClientRect.h" |
| 44 #include "core/dom/ClientRectList.h" | 44 #include "core/dom/ClientRectList.h" |
| 45 #include "core/dom/DOMPoint.h" |
| 45 #include "core/dom/DOMStringList.h" | 46 #include "core/dom/DOMStringList.h" |
| 46 #include "core/dom/Document.h" | 47 #include "core/dom/Document.h" |
| 47 #include "core/dom/DocumentMarker.h" | 48 #include "core/dom/DocumentMarker.h" |
| 48 #include "core/dom/DocumentMarkerController.h" | 49 #include "core/dom/DocumentMarkerController.h" |
| 49 #include "core/dom/Element.h" | 50 #include "core/dom/Element.h" |
| 50 #include "core/dom/ExceptionCode.h" | 51 #include "core/dom/ExceptionCode.h" |
| 51 #include "core/dom/NodeRenderStyle.h" | 52 #include "core/dom/NodeRenderStyle.h" |
| 52 #include "core/dom/PseudoElement.h" | 53 #include "core/dom/PseudoElement.h" |
| 53 #include "core/dom/Range.h" | 54 #include "core/dom/Range.h" |
| 54 #include "core/dom/StaticNodeList.h" | 55 #include "core/dom/StaticNodeList.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 #include "core/editing/SpellChecker.h" | 66 #include "core/editing/SpellChecker.h" |
| 66 #include "core/editing/SurroundingText.h" | 67 #include "core/editing/SurroundingText.h" |
| 67 #include "core/editing/TextIterator.h" | 68 #include "core/editing/TextIterator.h" |
| 68 #include "core/fetch/MemoryCache.h" | 69 #include "core/fetch/MemoryCache.h" |
| 69 #include "core/fetch/ResourceFetcher.h" | 70 #include "core/fetch/ResourceFetcher.h" |
| 70 #include "core/frame/LocalDOMWindow.h" | 71 #include "core/frame/LocalDOMWindow.h" |
| 71 #include "core/frame/EventHandlerRegistry.h" | 72 #include "core/frame/EventHandlerRegistry.h" |
| 72 #include "core/frame/FrameView.h" | 73 #include "core/frame/FrameView.h" |
| 73 #include "core/frame/LocalFrame.h" | 74 #include "core/frame/LocalFrame.h" |
| 74 #include "core/frame/Settings.h" | 75 #include "core/frame/Settings.h" |
| 75 #include "core/frame/WebKitPoint.h" | |
| 76 #include "core/html/HTMLContentElement.h" | 76 #include "core/html/HTMLContentElement.h" |
| 77 #include "core/html/HTMLIFrameElement.h" | 77 #include "core/html/HTMLIFrameElement.h" |
| 78 #include "core/html/HTMLInputElement.h" | 78 #include "core/html/HTMLInputElement.h" |
| 79 #include "core/html/HTMLMediaElement.h" | 79 #include "core/html/HTMLMediaElement.h" |
| 80 #include "core/html/HTMLPlugInElement.h" | 80 #include "core/html/HTMLPlugInElement.h" |
| 81 #include "core/html/HTMLSelectElement.h" | 81 #include "core/html/HTMLSelectElement.h" |
| 82 #include "core/html/HTMLTextAreaElement.h" | 82 #include "core/html/HTMLTextAreaElement.h" |
| 83 #include "core/html/canvas/CanvasRenderingContext2D.h" | 83 #include "core/html/canvas/CanvasRenderingContext2D.h" |
| 84 #include "core/html/forms/FormController.h" | 84 #include "core/html/forms/FormController.h" |
| 85 #include "core/html/shadow/ShadowElementNames.h" | 85 #include "core/html/shadow/ShadowElementNames.h" |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 955 |
| 956 String Internals::rangeAsText(const Range* range) | 956 String Internals::rangeAsText(const Range* range) |
| 957 { | 957 { |
| 958 ASSERT(range); | 958 ASSERT(range); |
| 959 return range->text(); | 959 return range->text(); |
| 960 } | 960 } |
| 961 | 961 |
| 962 // FIXME: The next four functions are very similar - combine them once | 962 // FIXME: The next four functions are very similar - combine them once |
| 963 // bestClickableNode/bestContextMenuNode have been combined.. | 963 // bestClickableNode/bestContextMenuNode have been combined.. |
| 964 | 964 |
| 965 PassRefPtrWillBeRawPtr<WebKitPoint> Internals::touchPositionAdjustedToBestClicka
bleNode(long x, long y, long width, long height, Document* document, ExceptionSt
ate& exceptionState) | 965 DOMPoint* Internals::touchPositionAdjustedToBestClickableNode(long x, long y, lo
ng width, long height, Document* document, ExceptionState& exceptionState) |
| 966 { | 966 { |
| 967 ASSERT(document); | 967 ASSERT(document); |
| 968 if (!document->frame()) { | 968 if (!document->frame()) { |
| 969 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 969 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 970 return nullptr; | 970 return 0; |
| 971 } | 971 } |
| 972 | 972 |
| 973 document->updateLayout(); | 973 document->updateLayout(); |
| 974 | 974 |
| 975 IntSize radius(width / 2, height / 2); | 975 IntSize radius(width / 2, height / 2); |
| 976 IntPoint point(x + radius.width(), y + radius.height()); | 976 IntPoint point(x + radius.width(), y + radius.height()); |
| 977 | 977 |
| 978 EventHandler& eventHandler = document->frame()->eventHandler(); | 978 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 979 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 979 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
| 980 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 980 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
| 981 | 981 |
| 982 Node* targetNode; | 982 Node* targetNode; |
| 983 IntPoint adjustedPoint; | 983 IntPoint adjustedPoint; |
| 984 | 984 |
| 985 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); | 985 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); |
| 986 if (foundNode) | 986 if (foundNode) |
| 987 return WebKitPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 987 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
| 988 | 988 |
| 989 return nullptr; | 989 return 0; |
| 990 } | 990 } |
| 991 | 991 |
| 992 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) | 992 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) |
| 993 { | 993 { |
| 994 ASSERT(document); | 994 ASSERT(document); |
| 995 if (!document->frame()) { | 995 if (!document->frame()) { |
| 996 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 996 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 997 return 0; | 997 return 0; |
| 998 } | 998 } |
| 999 | 999 |
| 1000 document->updateLayout(); | 1000 document->updateLayout(); |
| 1001 | 1001 |
| 1002 IntSize radius(width / 2, height / 2); | 1002 IntSize radius(width / 2, height / 2); |
| 1003 IntPoint point(x + radius.width(), y + radius.height()); | 1003 IntPoint point(x + radius.width(), y + radius.height()); |
| 1004 | 1004 |
| 1005 EventHandler& eventHandler = document->frame()->eventHandler(); | 1005 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1006 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1006 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
| 1007 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 1007 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
| 1008 | 1008 |
| 1009 Node* targetNode; | 1009 Node* targetNode; |
| 1010 IntPoint adjustedPoint; | 1010 IntPoint adjustedPoint; |
| 1011 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); | 1011 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); |
| 1012 return targetNode; | 1012 return targetNode; |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 PassRefPtrWillBeRawPtr<WebKitPoint> Internals::touchPositionAdjustedToBestContex
tMenuNode(long x, long y, long width, long height, Document* document, Exception
State& exceptionState) | 1015 DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) |
| 1016 { | 1016 { |
| 1017 ASSERT(document); | 1017 ASSERT(document); |
| 1018 if (!document->frame()) { | 1018 if (!document->frame()) { |
| 1019 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1019 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1020 return nullptr; | 1020 return 0; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 document->updateLayout(); | 1023 document->updateLayout(); |
| 1024 | 1024 |
| 1025 IntSize radius(width / 2, height / 2); | 1025 IntSize radius(width / 2, height / 2); |
| 1026 IntPoint point(x + radius.width(), y + radius.height()); | 1026 IntPoint point(x + radius.width(), y + radius.height()); |
| 1027 | 1027 |
| 1028 EventHandler& eventHandler = document->frame()->eventHandler(); | 1028 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1029 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1029 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
| 1030 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 1030 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
| 1031 | 1031 |
| 1032 Node* targetNode = 0; | 1032 Node* targetNode = 0; |
| 1033 IntPoint adjustedPoint; | 1033 IntPoint adjustedPoint; |
| 1034 | 1034 |
| 1035 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); | 1035 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); |
| 1036 if (foundNode) | 1036 if (foundNode) |
| 1037 return WebKitPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1037 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
| 1038 | 1038 |
| 1039 return WebKitPoint::create(x, y); | 1039 return DOMPoint::create(x, y); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) | 1042 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) |
| 1043 { | 1043 { |
| 1044 ASSERT(document); | 1044 ASSERT(document); |
| 1045 if (!document->frame()) { | 1045 if (!document->frame()) { |
| 1046 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1046 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1047 return 0; | 1047 return 0; |
| 1048 } | 1048 } |
| 1049 | 1049 |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 } | 2225 } |
| 2226 if (!element->isPluginElement()) { | 2226 if (!element->isPluginElement()) { |
| 2227 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov
ided is not a plugin."); | 2227 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov
ided is not a plugin."); |
| 2228 return; | 2228 return; |
| 2229 } | 2229 } |
| 2230 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState
); | 2230 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState
); |
| 2231 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); | 2231 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); |
| 2232 } | 2232 } |
| 2233 | 2233 |
| 2234 } // namespace blink | 2234 } // namespace blink |
| OLD | NEW |