| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 return true; | 2230 return true; |
| 2231 } | 2231 } |
| 2232 | 2232 |
| 2233 bool WebViewImpl::isSelectionAnchorFirst() const | 2233 bool WebViewImpl::isSelectionAnchorFirst() const |
| 2234 { | 2234 { |
| 2235 if (const LocalFrame* frame = focusedWebCoreFrame()) | 2235 if (const LocalFrame* frame = focusedWebCoreFrame()) |
| 2236 return frame->selection().selection().isBaseFirst(); | 2236 return frame->selection().selection().isBaseFirst(); |
| 2237 return false; | 2237 return false; |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 bool WebViewImpl::setEditableSelectionOffsets(int start, int end) | |
| 2241 { | |
| 2242 const LocalFrame* focused = focusedWebCoreFrame(); | |
| 2243 if (!focused) | |
| 2244 return false; | |
| 2245 return focused->inputMethodController().setEditableSelectionOffsets(PlainTex
tRange(start, end)); | |
| 2246 } | |
| 2247 | |
| 2248 bool WebViewImpl::setCompositionFromExistingText(int compositionStart, int compo
sitionEnd, const WebVector<WebCompositionUnderline>& underlines) | |
| 2249 { | |
| 2250 const LocalFrame* focused = focusedWebCoreFrame(); | |
| 2251 if (!focused) | |
| 2252 return false; | |
| 2253 | |
| 2254 if (!focused->editor().canEdit()) | |
| 2255 return false; | |
| 2256 | |
| 2257 InputMethodController& inputMethodController = focused->inputMethodControlle
r(); | |
| 2258 inputMethodController.cancelComposition(); | |
| 2259 | |
| 2260 if (compositionStart == compositionEnd) | |
| 2261 return true; | |
| 2262 | |
| 2263 inputMethodController.setCompositionFromExistingText(CompositionUnderlineVec
torBuilder(underlines), compositionStart, compositionEnd); | |
| 2264 | |
| 2265 return true; | |
| 2266 } | |
| 2267 | |
| 2268 WebVector<WebCompositionUnderline> WebViewImpl::compositionUnderlines() const | 2240 WebVector<WebCompositionUnderline> WebViewImpl::compositionUnderlines() const |
| 2269 { | 2241 { |
| 2270 const LocalFrame* focused = focusedWebCoreFrame(); | 2242 const LocalFrame* focused = focusedWebCoreFrame(); |
| 2271 if (!focused) | 2243 if (!focused) |
| 2272 return WebVector<WebCompositionUnderline>(); | 2244 return WebVector<WebCompositionUnderline>(); |
| 2273 const Vector<CompositionUnderline>& underlines = focused->inputMethodControl
ler().customCompositionUnderlines(); | 2245 const Vector<CompositionUnderline>& underlines = focused->inputMethodControl
ler().customCompositionUnderlines(); |
| 2274 WebVector<WebCompositionUnderline> results(underlines.size()); | 2246 WebVector<WebCompositionUnderline> results(underlines.size()); |
| 2275 for (size_t index = 0; index < underlines.size(); ++index) { | 2247 for (size_t index = 0; index < underlines.size(); ++index) { |
| 2276 CompositionUnderline underline = underlines[index]; | 2248 CompositionUnderline underline = underlines[index]; |
| 2277 results[index] = WebCompositionUnderline(underline.startOffset, underlin
e.endOffset, static_cast<WebColor>(underline.color.rgb()), underline.thick); | 2249 results[index] = WebCompositionUnderline(underline.startOffset, underlin
e.endOffset, static_cast<WebColor>(underline.color.rgb()), underline.thick); |
| 2278 } | 2250 } |
| 2279 return results; | 2251 return results; |
| 2280 } | 2252 } |
| 2281 | 2253 |
| 2282 void WebViewImpl::extendSelectionAndDelete(int before, int after) | |
| 2283 { | |
| 2284 LocalFrame* focused = focusedWebCoreFrame(); | |
| 2285 if (!focused) | |
| 2286 return; | |
| 2287 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) { | |
| 2288 plugin->extendSelectionAndDelete(before, after); | |
| 2289 return; | |
| 2290 } | |
| 2291 focused->inputMethodController().extendSelectionAndDelete(before, after); | |
| 2292 } | |
| 2293 | |
| 2294 WebColor WebViewImpl::backgroundColor() const | 2254 WebColor WebViewImpl::backgroundColor() const |
| 2295 { | 2255 { |
| 2296 if (isTransparent()) | 2256 if (isTransparent()) |
| 2297 return Color::transparent; | 2257 return Color::transparent; |
| 2298 if (!m_page) | 2258 if (!m_page) |
| 2299 return m_baseBackgroundColor; | 2259 return m_baseBackgroundColor; |
| 2300 if (!m_page->mainFrame()) | 2260 if (!m_page->mainFrame()) |
| 2301 return m_baseBackgroundColor; | 2261 return m_baseBackgroundColor; |
| 2302 FrameView* view = m_page->mainFrame()->view(); | 2262 FrameView* view = m_page->mainFrame()->view(); |
| 2303 return view->documentBackgroundColor().rgb(); | 2263 return view->documentBackgroundColor().rgb(); |
| (...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4003 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 3963 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4004 | 3964 |
| 4005 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 3965 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4006 return false; | 3966 return false; |
| 4007 | 3967 |
| 4008 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 3968 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4009 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 3969 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4010 } | 3970 } |
| 4011 | 3971 |
| 4012 } // namespace blink | 3972 } // namespace blink |
| OLD | NEW |