| 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 25 matching lines...) Expand all Loading... |
| 36 #include <algorithm> | 36 #include <algorithm> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect) | 40 void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect) |
| 41 { | 41 { |
| 42 IntRect screen = screenInfo().availableRect; | 42 IntRect screen = screenInfo().availableRect; |
| 43 IntRect window = pendingRect; | 43 IntRect window = pendingRect; |
| 44 | 44 |
| 45 IntSize minimumSize = minimumWindowSize(); | 45 IntSize minimumSize = minimumWindowSize(); |
| 46 // Let size 0 pass through, since that indicates default size, not minimum s
ize. | 46 // Let size 0 pass through, since that indicates default size, not minimum |
| 47 // size. |
| 47 if (window.width()) | 48 if (window.width()) |
| 48 window.setWidth(std::min(std::max(minimumSize.width(), window.width()),
screen.width())); | 49 window.setWidth(std::min(std::max(minimumSize.width(), window.width()),
screen.width())); |
| 49 if (window.height()) | 50 if (window.height()) |
| 50 window.setHeight(std::min(std::max(minimumSize.height(), window.height()
), screen.height())); | 51 window.setHeight(std::min(std::max(minimumSize.height(), window.height()
), screen.height())); |
| 51 | 52 |
| 52 // Constrain the window position within the valid screen area. | 53 // Constrain the window position within the valid screen area. |
| 53 window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window
.width()))); | 54 window.setX(std::max(screen.x(), std::min(window.x(), screen.maxX() - window
.width()))); |
| 54 window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window
.height()))); | 55 window.setY(std::max(screen.y(), std::min(window.y(), screen.maxY() - window
.height()))); |
| 55 setWindowRect(window); | 56 setWindowRect(window); |
| 56 } | 57 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 bool ChromeClient::runJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) | 134 bool ChromeClient::runJavaScriptPrompt(LocalFrame* frame, const String& prompt,
const String& defaultValue, String& result) |
| 134 { | 135 { |
| 135 ASSERT(frame); | 136 ASSERT(frame); |
| 136 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pro
mptDialog, prompt)) | 137 if (!canRunModalIfDuringPageDismissal(frame->tree().top(), ChromeClient::Pro
mptDialog, prompt)) |
| 137 return false; | 138 return false; |
| 138 return openJavaScriptDialog(this, &ChromeClient::runJavaScriptPromptInternal
, *frame, prompt, defaultValue, result); | 139 return openJavaScriptDialog(this, &ChromeClient::runJavaScriptPromptInternal
, *frame, prompt, defaultValue, result); |
| 139 } | 140 } |
| 140 | 141 |
| 141 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) | 142 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& result) |
| 142 { | 143 { |
| 143 if (result.innerNode()) { | 144 if (result.innerNode() && result.innerNode()->document().isDNSPrefetchEnable
d()) |
| 144 if (result.innerNode()->document().isDNSPrefetchEnabled()) | 145 prefetchDNS(result.absoluteLinkURL().host()); |
| 145 prefetchDNS(result.absoluteLinkURL().host()); | 146 |
| 146 } | |
| 147 showMouseOverURL(result); | 147 showMouseOverURL(result); |
| 148 | 148 |
| 149 setToolTip(result); | 149 setToolTip(result); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ChromeClient::setToolTip(const HitTestResult& result) | 152 void ChromeClient::setToolTip(const HitTestResult& result) |
| 153 { | 153 { |
| 154 // First priority is a potential toolTip representing a spelling or grammar
error | 154 // First priority is a potential toolTip representing a spelling or grammar |
| 155 // error. |
| 155 TextDirection toolTipDirection; | 156 TextDirection toolTipDirection; |
| 156 String toolTip = result.spellingToolTip(toolTipDirection); | 157 String toolTip = result.spellingToolTip(toolTipDirection); |
| 157 | 158 |
| 158 // Next we'll consider a tooltip for element with "title" attribute | 159 // Next we'll consider a tooltip for element with "title" attribute. |
| 159 if (toolTip.isEmpty()) | 160 if (toolTip.isEmpty()) |
| 160 toolTip = result.title(toolTipDirection); | 161 toolTip = result.title(toolTipDirection); |
| 161 | 162 |
| 162 // Lastly, for <input type="file"> that allow multiple files, we'll consider
a tooltip for the selected filenames | 163 // Lastly, for <input type="file"> that allow multiple files, we'll consider |
| 164 // a tooltip for the selected filenames. |
| 163 if (toolTip.isEmpty()) { | 165 if (toolTip.isEmpty()) { |
| 164 if (Node* node = result.innerNode()) { | 166 if (Node* node = result.innerNode()) { |
| 165 if (isHTMLInputElement(*node)) { | 167 if (isHTMLInputElement(*node)) { |
| 166 HTMLInputElement* input = toHTMLInputElement(node); | 168 HTMLInputElement* input = toHTMLInputElement(node); |
| 167 toolTip = input->defaultToolTip(); | 169 toolTip = input->defaultToolTip(); |
| 168 | 170 |
| 169 // FIXME: We should obtain text direction of tooltip from | 171 // FIXME: We should obtain text direction of tooltip from |
| 170 // ChromeClient or platform. As of October 2011, all client | 172 // ChromeClient or platform. As of October 2011, all client |
| 171 // implementations don't use text direction information for | 173 // implementations don't use text direction information for |
| 172 // ChromeClient::setToolTip. We'll work on tooltip text | 174 // ChromeClient::setToolTip. We'll work on tooltip text |
| 173 // direction during bidi cleanup in form inputs. | 175 // direction during bidi cleanup in form inputs. |
| 174 toolTipDirection = LTR; | 176 toolTipDirection = LTR; |
| 175 } | 177 } |
| 176 } | 178 } |
| 177 } | 179 } |
| 178 | 180 |
| 179 setToolTip(toolTip, toolTipDirection); | 181 setToolTip(toolTip, toolTipDirection); |
| 180 } | 182 } |
| 181 | 183 |
| 182 void ChromeClient::print(LocalFrame* frame) | 184 void ChromeClient::print(LocalFrame* frame) |
| 183 { | 185 { |
| 184 // Defer loads in case the client method runs a new event loop that would | 186 // Defer loads in case the client method runs a new event loop that would |
| 185 // otherwise cause the load to continue while we're in the middle of executi
ng JavaScript. | 187 // otherwise cause the load to continue while we're in the middle of |
| 188 // executing JavaScript. |
| 186 ScopedPageLoadDeferrer deferrer; | 189 ScopedPageLoadDeferrer deferrer; |
| 187 | 190 |
| 188 printInternal(frame); | 191 printInternal(frame); |
| 189 } | 192 } |
| 190 | 193 |
| 191 void ChromeClient::setCursor(const Cursor& cursor) | 194 void ChromeClient::setCursor(const Cursor& cursor) |
| 192 { | 195 { |
| 193 m_lastSetMouseCursorForTesting = cursor; | 196 m_lastSetMouseCursorForTesting = cursor; |
| 194 setCursorInternal(cursor); | 197 setCursorInternal(cursor); |
| 195 } | 198 } |
| 196 | 199 |
| 197 Cursor ChromeClient::getLastSetCursorForTesting() const | 200 Cursor ChromeClient::getLastSetCursorForTesting() const |
| 198 { | 201 { |
| 199 return m_lastSetMouseCursorForTesting; | 202 return m_lastSetMouseCursorForTesting; |
| 200 } | 203 } |
| 201 | 204 |
| 202 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |