Chromium Code Reviews| 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 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2297 // editable because JavaScript may delete a parent node of the composition | 2297 // editable because JavaScript may delete a parent node of the composition |
| 2298 // node. In this case, WebKit crashes while deleting texts from the parent | 2298 // node. In this case, WebKit crashes while deleting texts from the parent |
| 2299 // node, which doesn't exist any longer. | 2299 // node, which doesn't exist any longer. |
| 2300 RefPtrWillBeRawPtr<Range> range = inputMethodController.compositionRange(); | 2300 RefPtrWillBeRawPtr<Range> range = inputMethodController.compositionRange(); |
| 2301 if (range) { | 2301 if (range) { |
| 2302 Node* node = range->startContainer(); | 2302 Node* node = range->startContainer(); |
| 2303 if (!node || !node->isContentEditable()) | 2303 if (!node || !node->isContentEditable()) |
| 2304 return false; | 2304 return false; |
| 2305 } | 2305 } |
| 2306 | 2306 |
| 2307 // If we're not going to fire a keypress event, then the keydown event was | 2307 // A keypress event is canceled. If an ongoing composition exists, then the |
| 2308 // canceled. In that case, cancel any existing composition. | 2308 // keydown event should have arisen from a handled key (e.g., backspace), so we |
| 2309 if (text.isEmpty() || m_suppressNextKeypressEvent) { | 2309 // ignore the cancellation and continue. Otherwise (no ongoing composition) we |
| 2310 // A browser process sent an IPC message which does not contain a valid | 2310 // exit and signal success only for attempts to clear the composition. |
| 2311 // string, which means an ongoing composition has been canceled. | 2311 if (m_suppressNextKeypressEvent && !inputMethodController.hasComposition()) { |
|
aelias_OOO_until_Jul13
2015/03/02 08:48:57
nit: no braces here
| |
| 2312 // If the ongoing composition has been canceled, replace the ongoing | |
| 2313 // composition string with an empty string and complete it. | |
| 2314 String emptyString; | |
| 2315 Vector<CompositionUnderline> emptyUnderlines; | |
| 2316 inputMethodController.setComposition(emptyString, emptyUnderlines, 0, 0) ; | |
| 2317 return text.isEmpty(); | 2312 return text.isEmpty(); |
| 2318 } | 2313 } |
| 2314 // An attempt to clear the composition, possibly an attempt to cancel the | |
| 2315 // composition by an IPC message from a browser process. | |
| 2316 if (text.isEmpty()) { | |
|
aelias_OOO_until_Jul13
2015/03/02 08:48:57
How about deleting this entire block? The setComp
huangs
2015/03/02 16:30:46
We pass different values for underlines, selection
aelias_OOO_until_Jul13
2015/03/02 17:55:37
Yes, but if you look at the implementation in Inpu
huangs
2015/03/02 19:11:15
There's still a code path where |underline| gets u
aelias_OOO_until_Jul13
2015/03/02 19:34:07
I don't think it's some implementation detail that
huangs
2015/03/02 20:09:18
Done.
| |
| 2317 if (inputMethodController.hasComposition()) { | |
| 2318 // If an ongoing composition exists, replacing it with an empty stri ng. | |
| 2319 String emptyString; | |
| 2320 Vector<CompositionUnderline> emptyUnderlines; | |
| 2321 inputMethodController.setComposition(emptyString, emptyUnderlines, 0 , 0); | |
| 2322 } | |
| 2323 return true; | |
| 2324 } | |
| 2319 | 2325 |
| 2320 // When the range of composition underlines overlap with the range between | 2326 // When the range of composition underlines overlap with the range between |
| 2321 // selectionStart and selectionEnd, WebKit somehow won't paint the selection | 2327 // selectionStart and selectionEnd, WebKit somehow won't paint the selection |
| 2322 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). | 2328 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). |
| 2323 // But the selection range actually takes effect. | 2329 // But the selection range actually takes effect. |
| 2324 inputMethodController.setComposition(String(text), | 2330 inputMethodController.setComposition(String(text), |
| 2325 CompositionUnderlineVectorBuilder(underlines), | 2331 CompositionUnderlineVectorBuilder(underlines), |
| 2326 selectionStart, selectionEnd); | 2332 selectionStart, selectionEnd); |
| 2327 | 2333 |
| 2328 return inputMethodController.hasComposition(); | 2334 return inputMethodController.hasComposition(); |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4671 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4677 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4672 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4678 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4673 } | 4679 } |
| 4674 | 4680 |
| 4675 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4681 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4676 { | 4682 { |
| 4677 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4683 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4678 } | 4684 } |
| 4679 | 4685 |
| 4680 } // namespace blink | 4686 } // namespace blink |
| OLD | NEW |