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 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2137 scaledAnchor.scale(pageScaleFactor()); | 2137 scaledAnchor.scale(pageScaleFactor()); |
| 2138 scaledFocus.scale(pageScaleFactor()); | 2138 scaledFocus.scale(pageScaleFactor()); |
| 2139 anchor = scaledAnchor; | 2139 anchor = scaledAnchor; |
| 2140 focus = scaledFocus; | 2140 focus = scaledFocus; |
| 2141 | 2141 |
| 2142 if (!selection.selection().isBaseFirst()) | 2142 if (!selection.selection().isBaseFirst()) |
| 2143 std::swap(anchor, focus); | 2143 std::swap(anchor, focus); |
| 2144 return true; | 2144 return true; |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 bool WebViewImpl::selectionRootBounds(WebRect& bounds) const | |
| 2148 { | |
| 2149 const LocalFrame* frame = focusedWebCoreFrame(); | |
| 2150 if (!frame) | |
| 2151 return false; | |
| 2152 | |
| 2153 Element* root = frame->selection().rootEditableElementOrDocumentElement(); | |
| 2154 if (!root) | |
| 2155 return false; | |
| 2156 | |
| 2157 // If the selection is inside a form control, the root will be a <div> that | |
|
timvolodine
2014/03/06 17:02:02
What about textarea elements? Could you list all c
mlamouri (slow - plz ping)
2014/03/10 16:05:59
Done.
| |
| 2158 // behaves as the editor but we want to return the actual element's bounds. | |
| 2159 if (root->shadowHost() | |
| 2160 && (root->shadowHost()->hasTagName(HTMLNames::textareaTag) | |
| 2161 || (root->shadowHost()->hasTagName(HTMLNames::inputTag) | |
| 2162 && toHTMLInputElement(root->shadowHost())->isText()))) { | |
|
timvolodine
2014/03/05 19:41:02
no single-line brackets
mlamouri (slow - plz ping)
2014/03/06 13:45:31
Given the size of the condition, I think having br
timvolodine
2014/03/06 17:02:02
I was actually referring to: http://dev.chromium.o
mlamouri (slow - plz ping)
2014/03/10 16:05:59
I fixed the brackets. Switching to root->shadowHos
timvolodine
2014/03/10 17:50:00
The more I look at this now the more I am for putt
| |
| 2163 root = root->shadowHost(); | |
| 2164 } | |
| 2165 | |
| 2166 IntRect boundingBox = root->pixelSnappedBoundingBox(); | |
| 2167 boundingBox = root->document().frame()->view()->contentsToWindow(boundingBox ); | |
| 2168 boundingBox.scale(pageScaleFactor()); | |
| 2169 bounds = boundingBox; | |
| 2170 | |
| 2171 return true; | |
| 2172 } | |
| 2173 | |
| 2147 InputMethodContext* WebViewImpl::inputMethodContext() | 2174 InputMethodContext* WebViewImpl::inputMethodContext() |
| 2148 { | 2175 { |
| 2149 if (!m_imeAcceptEvents) | 2176 if (!m_imeAcceptEvents) |
| 2150 return 0; | 2177 return 0; |
| 2151 | 2178 |
| 2152 LocalFrame* focusedFrame = focusedWebCoreFrame(); | 2179 LocalFrame* focusedFrame = focusedWebCoreFrame(); |
| 2153 if (!focusedFrame) | 2180 if (!focusedFrame) |
| 2154 return 0; | 2181 return 0; |
| 2155 | 2182 |
| 2156 Element* target = focusedFrame->document()->focusedElement(); | 2183 Element* target = focusedFrame->document()->focusedElement(); |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3974 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4001 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 3975 | 4002 |
| 3976 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4003 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 3977 return false; | 4004 return false; |
| 3978 | 4005 |
| 3979 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4006 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 3980 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4007 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 3981 } | 4008 } |
| 3982 | 4009 |
| 3983 } // namespace blink | 4010 } // namespace blink |
| OLD | NEW |