summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-26 13:57:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-02 11:31:01 +0000
commit1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch)
tree8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
parent21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff)
downloadqtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc b/chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
index 58c5409858b..f9266ca880b 100644
--- a/chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
+++ b/chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
@@ -3,12 +3,15 @@
// found in the LICENSE file.
#include "third_party/blink/renderer/core/paint/selection_bounds_recorder.h"
+
#include "third_party/blink/renderer/core/editing/frame_selection.h"
+#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/layout/api/selection_state.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
-#include "third_party/blink/renderer/core/layout/layout_view.h"
+#include "third_party/blink/renderer/core/page/focus_controller.h"
+#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
namespace blink {
@@ -164,6 +167,16 @@ bool SelectionBoundsRecorder::ShouldRecordSelection(
if (!frame_selection.IsHandleVisible() || frame_selection.IsHidden())
return false;
+ // If the currently focused frame is not the one in which selection
+ // lives, don't paint the selection bounds. Note this is subtly different
+ // from whether the frame has focus (i.e. `FrameSelection::SelectionHasFocus`)
+ // which is false if the hosting window is not focused.
+ LocalFrame* local_frame = frame_selection.GetFrame();
+ LocalFrame* focused_frame =
+ local_frame->GetPage()->GetFocusController().FocusedFrame();
+ if (local_frame != focused_frame)
+ return false;
+
if (state == SelectionState::kInside || state == SelectionState::kNone)
return false;
@@ -189,7 +202,7 @@ bool SelectionBoundsRecorder::IsVisible(const LayoutObject& rect_layout_object,
return true;
const PhysicalOffset sample_point = GetSamplePointForVisibility(
- edge_start, edge_end, rect_layout_object.View()->ZoomFactor());
+ edge_start, edge_end, rect_layout_object.GetFrame()->PageZoomFactor());
auto* const text_control_object = To<LayoutBox>(layout_object);
const PhysicalOffset position_in_input =