OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 23 matching lines...) Expand all Loading... | |
34 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
35 #include "public/platform/WebPoint.h" | 35 #include "public/platform/WebPoint.h" |
36 #include "public/platform/WebURL.h" | 36 #include "public/platform/WebURL.h" |
37 #include "public/web/WebElement.h" | 37 #include "public/web/WebElement.h" |
38 #include "public/web/WebNode.h" | 38 #include "public/web/WebNode.h" |
39 | 39 |
40 using namespace WebCore; | 40 using namespace WebCore; |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class WebHitTestResultPrivate { | |
45 public: | |
46 WebHitTestResultPrivate(const HitTestResult&); | |
47 WebHitTestResultPrivate(const WebHitTestResultPrivate&); | |
48 | |
49 RefPtrWillBePersistent<Node> innerNode; | |
50 RefPtrWillBePersistent<Element> innerURLElement; | |
51 LayoutPoint localPoint; | |
52 KURL absoluteImageURL; | |
53 KURL absoluteLinkURL; | |
54 bool isContentEditable; | |
55 }; | |
56 | |
57 inline WebHitTestResultPrivate::WebHitTestResultPrivate(const HitTestResult& res ult) | |
58 : innerNode(result.innerNode()) | |
59 , innerURLElement(result.URLElement()) | |
60 , localPoint(result.localPoint()) | |
61 , absoluteImageURL(result.absoluteImageURL()) | |
62 , absoluteLinkURL(result.absoluteLinkURL()) | |
63 , isContentEditable(result.isContentEditable()) | |
64 { | |
65 } | |
66 | |
67 inline WebHitTestResultPrivate::WebHitTestResultPrivate(const WebHitTestResultPr ivate& result) | |
68 : innerNode(result.innerNode) | |
69 , innerURLElement(result.innerURLElement) | |
70 , localPoint(result.localPoint) | |
71 , absoluteImageURL(result.absoluteImageURL) | |
72 , absoluteLinkURL(result.absoluteLinkURL) | |
73 , isContentEditable(result.isContentEditable) | |
74 { | |
75 } | |
76 | |
44 WebNode WebHitTestResult::node() const | 77 WebNode WebHitTestResult::node() const |
45 { | 78 { |
46 return WebNode(m_private->innerNode()); | 79 return WebNode(m_private->innerNode); |
47 } | 80 } |
48 | 81 |
49 WebPoint WebHitTestResult::localPoint() const | 82 WebPoint WebHitTestResult::localPoint() const |
50 { | 83 { |
51 return roundedIntPoint(m_private->localPoint()); | 84 return roundedIntPoint(m_private->localPoint); |
52 } | 85 } |
53 | 86 |
54 WebElement WebHitTestResult::urlElement() const | 87 WebElement WebHitTestResult::urlElement() const |
55 { | 88 { |
56 return WebElement(m_private->URLElement()); | 89 return WebElement(m_private->innerURLElement); |
57 } | 90 } |
58 | 91 |
59 WebURL WebHitTestResult::absoluteImageURL() const | 92 WebURL WebHitTestResult::absoluteImageURL() const |
60 { | 93 { |
61 return m_private->absoluteImageURL(); | 94 return m_private->absoluteImageURL; |
62 } | 95 } |
63 | 96 |
64 WebURL WebHitTestResult::absoluteLinkURL() const | 97 WebURL WebHitTestResult::absoluteLinkURL() const |
65 { | 98 { |
66 return m_private->absoluteLinkURL(); | 99 return m_private->absoluteLinkURL; |
67 } | 100 } |
68 | 101 |
69 bool WebHitTestResult::isContentEditable() const | 102 bool WebHitTestResult::isContentEditable() const |
70 { | 103 { |
71 return m_private->isContentEditable(); | 104 return m_private->isContentEditable; |
72 } | 105 } |
73 | 106 |
74 WebHitTestResult::WebHitTestResult(const HitTestResult& result) | 107 WebHitTestResult::WebHitTestResult(const HitTestResult& result) |
75 { | 108 { |
76 m_private.reset(new HitTestResult(result)); | 109 m_private.reset(new WebHitTestResultPrivate(result)); |
77 } | 110 } |
78 | 111 |
79 WebHitTestResult& WebHitTestResult::operator=(const HitTestResult& result) | 112 WebHitTestResult& WebHitTestResult::operator=(const HitTestResult& result) |
80 { | 113 { |
81 m_private.reset(new HitTestResult(result)); | 114 m_private.reset(new WebHitTestResultPrivate(result)); |
82 return *this; | 115 return *this; |
83 } | 116 } |
84 | 117 |
85 WebHitTestResult::operator HitTestResult() const | |
86 { | |
87 return *m_private.get(); | |
88 } | |
89 | |
90 bool WebHitTestResult::isNull() const | 118 bool WebHitTestResult::isNull() const |
91 { | 119 { |
92 return !m_private.get(); | 120 return !m_private.get(); |
93 } | 121 } |
94 | 122 |
95 void WebHitTestResult::assign(const WebHitTestResult& info) | 123 void WebHitTestResult::assign(const WebHitTestResult& info) |
96 { | 124 { |
97 m_private.reset(new HitTestResult(info)); | 125 if (info.m_private.get()) |
haraken
2014/06/18 01:27:25
You can use info.isNull().
tkent
2014/06/18 03:10:40
Done.
| |
126 m_private.reset(new WebHitTestResultPrivate(*info.m_private.get())); | |
127 else | |
128 m_private.reset(0); | |
98 } | 129 } |
99 | 130 |
100 void WebHitTestResult::reset() | 131 void WebHitTestResult::reset() |
101 { | 132 { |
102 m_private.reset(0); | 133 m_private.reset(0); |
103 } | 134 } |
104 | 135 |
105 } // namespace blink | 136 } // namespace blink |
OLD | NEW |