Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2910233002: Do not fallback to FocusedOrMainFrame() in FocusedLocalFrameInWidget() (Closed)
Patch Set: Rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.h ('k') | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index 6c6229206f60bef3f80699470ae1c146f9b393c2..8636c12cd91ac249f1e5628ea1b1a4223cc77839 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -118,7 +118,6 @@ WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client,
background_color_override_(Color::kTransparent),
base_background_color_override_enabled_(false),
base_background_color_override_(Color::kTransparent),
- ime_accept_events_(true),
self_keep_alive_(this) {
DCHECK(local_root_->GetFrame()->IsLocalRoot());
InitializeLayerTreeView();
@@ -461,7 +460,7 @@ void WebFrameWidgetImpl::UpdateBaseBackgroundColor() {
WebInputMethodController*
WebFrameWidgetImpl::GetActiveWebInputMethodController() const {
WebLocalFrameBase* local_frame =
- WebLocalFrameBase::FromFrame(FocusedLocalFrameInWidget());
+ WebLocalFrameBase::FromFrame(FocusedLocalFrame());
return local_frame ? local_frame->GetInputMethodController() : nullptr;
}
@@ -538,7 +537,7 @@ void WebFrameWidgetImpl::SetFocus(bool enable) {
}
ime_accept_events_ = true;
} else {
- LocalFrame* focused_frame = FocusedLocalFrameInWidget();
+ LocalFrame* focused_frame = FocusedLocalFrame();
if (focused_frame) {
// Finish an ongoing composition to delete the composition node.
if (focused_frame->GetInputMethodController().HasComposition()) {
@@ -559,7 +558,10 @@ void WebFrameWidgetImpl::SetFocus(bool enable) {
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
// code needs to be refactored (http://crbug.com/629721).
WebRange WebFrameWidgetImpl::CompositionRange() {
- LocalFrame* focused = FocusedLocalFrameAvailableForIme();
+ if (!ime_accept_events_)
+ return WebRange();
+
+ LocalFrame* focused = FocusedLocalFrame();
if (!focused)
return WebRange();
@@ -592,7 +594,7 @@ WebColor WebFrameWidgetImpl::BackgroundColor() const {
// code needs to be refactored (http://crbug.com/629721).
bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor,
WebRect& focus) const {
- const LocalFrame* local_frame = FocusedLocalFrameInWidget();
+ const LocalFrame* local_frame = FocusedLocalFrame();
if (!local_frame)
return false;
@@ -641,7 +643,7 @@ bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor,
// code needs to be refactored (http://crbug.com/629721).
bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start,
WebTextDirection& end) const {
- const LocalFrame* frame = FocusedLocalFrameInWidget();
+ const LocalFrame* frame = FocusedLocalFrame();
if (!frame)
return false;
@@ -667,7 +669,7 @@ bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start,
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
// code needs to be refactored (http://crbug.com/629721).
bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const {
- if (const LocalFrame* frame = FocusedLocalFrameInWidget()) {
+ if (const LocalFrame* frame = FocusedLocalFrame()) {
FrameSelection& selection = frame->Selection();
return selection.IsAvailable() &&
selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst();
@@ -678,7 +680,7 @@ bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const {
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
// code needs to be refactored (http://crbug.com/629721).
WebRange WebFrameWidgetImpl::CaretOrSelectionRange() {
- LocalFrame* focused = FocusedLocalFrameInWidget();
+ LocalFrame* focused = FocusedLocalFrame();
if (!focused)
return WebRange();
@@ -694,7 +696,7 @@ void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) {
// the text direction of the selected node and updates its DOM "dir"
// attribute and its CSS "direction" property.
// So, we just call the function as Safari does.
- const LocalFrame* focused = FocusedLocalFrameInWidget();
+ const LocalFrame* focused = FocusedLocalFrame();
if (!focused)
return;
@@ -746,7 +748,7 @@ bool WebFrameWidgetImpl::GetCompositionCharacterBounds(
if (range.IsEmpty())
return false;
- LocalFrame* frame = FocusedLocalFrameInWidget();
+ LocalFrame* frame = FocusedLocalFrame();
if (!frame)
return false;
@@ -1193,17 +1195,4 @@ HitTestResult WebFrameWidgetImpl::HitTestResultForRootFramePos(
return result;
}
-LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameInWidget() const {
- LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame();
- return (frame && frame->LocalFrameRoot() == local_root_->GetFrame())
- ? frame
- : nullptr;
-}
-
-LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const {
- if (!ime_accept_events_)
- return nullptr;
- return FocusedLocalFrameInWidget();
-}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.h ('k') | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698