OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "core/page/FrameTree.h" | 31 #include "core/page/FrameTree.h" |
32 #include "core/page/ScopedPageSuspender.h" | 32 #include "core/page/ScopedPageSuspender.h" |
33 #include "core/page/WindowFeatures.h" | 33 #include "core/page/WindowFeatures.h" |
34 #include "platform/geometry/IntRect.h" | 34 #include "platform/geometry/IntRect.h" |
35 #include "platform/network/NetworkHints.h" | 35 #include "platform/network/NetworkHints.h" |
36 #include "public/platform/WebScreenInfo.h" | 36 #include "public/platform/WebScreenInfo.h" |
37 #include <algorithm> | 37 #include <algorithm> |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
| 41 DEFINE_TRACE(ChromeClient) { |
| 42 visitor->trace(m_lastMouseOverNode); |
| 43 HostWindow::trace(visitor); |
| 44 } |
| 45 |
41 void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect, | 46 void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect, |
42 LocalFrame& frame) { | 47 LocalFrame& frame) { |
43 IntRect screen = screenInfo().availableRect; | 48 IntRect screen = screenInfo().availableRect; |
44 IntRect window = pendingRect; | 49 IntRect window = pendingRect; |
45 | 50 |
46 IntSize minimumSize = minimumWindowSize(); | 51 IntSize minimumSize = minimumWindowSize(); |
47 // Let size 0 pass through, since that indicates default size, not minimum | 52 // Let size 0 pass through, since that indicates default size, not minimum |
48 // size. | 53 // size. |
49 if (window.width()) | 54 if (window.width()) |
50 window.setWidth(std::min(std::max(minimumSize.width(), window.width()), | 55 window.setWidth(std::min(std::max(minimumSize.width(), window.width()), |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // ChromeClient::setToolTip. We'll work on tooltip text | 186 // ChromeClient::setToolTip. We'll work on tooltip text |
182 // direction during bidi cleanup in form inputs. | 187 // direction during bidi cleanup in form inputs. |
183 toolTipDirection = TextDirection::Ltr; | 188 toolTipDirection = TextDirection::Ltr; |
184 } | 189 } |
185 } | 190 } |
186 } | 191 } |
187 | 192 |
188 if (m_lastToolTipPoint == result.hitTestLocation().point() && | 193 if (m_lastToolTipPoint == result.hitTestLocation().point() && |
189 m_lastToolTipText == toolTip) | 194 m_lastToolTipText == toolTip) |
190 return; | 195 return; |
| 196 |
| 197 // If a tooltip was displayed earlier, and the user has moved the mouse |
| 198 // cursor over a different node, make sure the previous tooltip is unset. |
| 199 // If the newly hovered node has a tooltip, then ::setToolTip will be called |
| 200 // later with the new text. |
| 201 if (result.innerNodeOrImageMapImage() != m_lastMouseOverNode && |
| 202 !m_lastToolTipText.isEmpty() && toolTip == m_lastToolTipText) |
| 203 clearToolTip(frame); |
| 204 |
191 m_lastToolTipPoint = result.hitTestLocation().point(); | 205 m_lastToolTipPoint = result.hitTestLocation().point(); |
192 m_lastToolTipText = toolTip; | 206 m_lastToolTipText = toolTip; |
| 207 m_lastMouseOverNode = result.innerNodeOrImageMapImage(); |
193 setToolTip(frame, toolTip, toolTipDirection); | 208 setToolTip(frame, toolTip, toolTipDirection); |
194 } | 209 } |
195 | 210 |
196 void ChromeClient::clearToolTip(LocalFrame& frame) { | 211 void ChromeClient::clearToolTip(LocalFrame& frame) { |
197 // Do not check m_lastToolTip* and do not update them intentionally. | 212 // Do not check m_lastToolTip* and do not update them intentionally. |
198 // We don't want to show tooltips with same content after clearToolTip(). | 213 // We don't want to show tooltips with same content after clearToolTip(). |
199 setToolTip(frame, String(), TextDirection::Ltr); | 214 setToolTip(frame, String(), TextDirection::Ltr); |
200 } | 215 } |
201 | 216 |
202 bool ChromeClient::print(LocalFrame* frame) { | 217 bool ChromeClient::print(LocalFrame* frame) { |
203 if (frame->document()->isSandboxed(SandboxModals)) { | 218 if (frame->document()->isSandboxed(SandboxModals)) { |
204 UseCounter::count(frame, UseCounter::DialogInSandboxedContext); | 219 UseCounter::count(frame, UseCounter::DialogInSandboxedContext); |
205 frame->console().addMessage(ConsoleMessage::create( | 220 frame->console().addMessage(ConsoleMessage::create( |
206 SecurityMessageSource, ErrorMessageLevel, | 221 SecurityMessageSource, ErrorMessageLevel, |
207 "Ignored call to 'print()'. The document is sandboxed, and the " | 222 "Ignored call to 'print()'. The document is sandboxed, and the " |
208 "'allow-modals' keyword is not set.")); | 223 "'allow-modals' keyword is not set.")); |
209 return false; | 224 return false; |
210 } | 225 } |
211 | 226 |
212 // Suspend pages in case the client method runs a new event loop that would | 227 // Suspend pages in case the client method runs a new event loop that would |
213 // otherwise cause the load to continue while we're in the middle of | 228 // otherwise cause the load to continue while we're in the middle of |
214 // executing JavaScript. | 229 // executing JavaScript. |
215 ScopedPageSuspender suspender; | 230 ScopedPageSuspender suspender; |
216 | 231 |
217 printDelegate(frame); | 232 printDelegate(frame); |
218 return true; | 233 return true; |
219 } | 234 } |
220 | 235 |
221 } // namespace blink | 236 } // namespace blink |
OLD | NEW |