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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 m_client->scheduleAnimation(); | 833 m_client->scheduleAnimation(); |
| 834 } | 834 } |
| 835 | 835 |
| 836 void WebViewImpl::setShowScrollBottleneckRects(bool show) | 836 void WebViewImpl::setShowScrollBottleneckRects(bool show) |
| 837 { | 837 { |
| 838 if (m_layerTreeView) | 838 if (m_layerTreeView) |
| 839 m_layerTreeView->setShowScrollBottleneckRects(show); | 839 m_layerTreeView->setShowScrollBottleneckRects(show); |
| 840 m_showScrollBottleneckRects = show; | 840 m_showScrollBottleneckRects = show; |
| 841 } | 841 } |
| 842 | 842 |
| 843 void WebViewImpl::getSelectionRootBounds(WebRect& bounds) const | |
| 844 { | |
| 845 const LocalFrame* frame = focusedWebCoreFrame(); | |
| 846 if (!frame) | |
| 847 return; | |
| 848 | |
| 849 Element* root = frame->selection().rootEditableElementOrDocumentElement(); | |
| 850 if (!root) | |
| 851 return; | |
| 852 | |
| 853 // If the selection is inside a form control, the root will be a <div> that | |
| 854 // behaves as the editor but we want to return the actual element's bounds. | |
| 855 // In practice, that means <textarea> and <input> controls that behave like | |
| 856 // a text field. | |
|
jamesr
2014/03/11 21:58:39
this seems reasonable it's a bit subtle - you need
| |
| 857 Element* shadowHost = root->shadowHost(); | |
| 858 if (shadowHost | |
| 859 && (shadowHost->hasTagName(HTMLNames::textareaTag) | |
| 860 || (shadowHost->hasTagName(HTMLNames::inputTag) | |
| 861 && toHTMLInputElement(shadowHost)->isText()))) | |
| 862 root = shadowHost; | |
| 863 | |
| 864 IntRect boundingBox = root->pixelSnappedBoundingBox(); | |
| 865 boundingBox = root->document().frame()->view()->contentsToWindow(boundingBox ); | |
| 866 boundingBox.scale(pageScaleFactor()); | |
| 867 bounds = boundingBox; | |
| 868 } | |
| 869 | |
| 843 bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) | 870 bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| 844 { | 871 { |
| 845 ASSERT((event.type == WebInputEvent::RawKeyDown) | 872 ASSERT((event.type == WebInputEvent::RawKeyDown) |
| 846 || (event.type == WebInputEvent::KeyDown) | 873 || (event.type == WebInputEvent::KeyDown) |
| 847 || (event.type == WebInputEvent::KeyUp)); | 874 || (event.type == WebInputEvent::KeyUp)); |
| 848 | 875 |
| 849 // Halt an in-progress fling on a key event. | 876 // Halt an in-progress fling on a key event. |
| 850 endActiveFlingAnimation(); | 877 endActiveFlingAnimation(); |
| 851 | 878 |
| 852 // Please refer to the comments explaining the m_suppressNextKeypressEvent | 879 // Please refer to the comments explaining the m_suppressNextKeypressEvent |
| (...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3968 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 3995 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 3969 | 3996 |
| 3970 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 3997 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 3971 return false; | 3998 return false; |
| 3972 | 3999 |
| 3973 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4000 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 3974 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4001 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 3975 } | 4002 } |
| 3976 | 4003 |
| 3977 } // namespace blink | 4004 } // namespace blink |
| OLD | NEW |