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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 929213004: Plumb selection bounds as a single unit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 512cc75da1ae88b491bf368f156a884b82810cc0..b0afe11cf3ad4f2948a756ca972c01a4afc39771 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -1670,7 +1670,7 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
}
}
-bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSelectionBound& start, CompositedSelectionBound& end)
+bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSelectionBounds& bounds)
{
const VisibleSelection &selection = frame.selection().selection();
if (!selection.isCaretOrRange())
@@ -1682,23 +1682,26 @@ bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe
RenderedPosition renderedStart(visibleStart);
RenderedPosition renderedEnd(visibleEnd);
- renderedStart.positionInGraphicsLayerBacking(start);
- if (!start.layer)
+ renderedStart.positionInGraphicsLayerBacking(bounds.start);
+ if (!bounds.start.layer)
return false;
- renderedEnd.positionInGraphicsLayerBacking(end);
- if (!end.layer)
+ renderedEnd.positionInGraphicsLayerBacking(bounds.end);
+ if (!bounds.end.layer)
return false;
+ bounds.isEditable = selection.hasEditableStyle();
+ bounds.isUserTriggered = selection.();
+
if (selection.isCaret()) {
- start.type = end.type = CompositedSelectionBound::Caret;
+ bounds.start.type = bounds.end.type = CompositedSelectionBound::Caret;
return true;
}
TextDirection startDir = visibleStart.deepEquivalent().primaryDirection();
TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection();
- start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : CompositedSelectionBound::SelectionLeft;
- end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : CompositedSelectionBound::SelectionRight;
+ bounds.start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : CompositedSelectionBound::SelectionLeft;
+ bounds.end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : CompositedSelectionBound::SelectionRight;
return true;
}
@@ -1710,14 +1713,14 @@ void FrameView::updateCompositedSelectionBoundsIfNeeded()
Page* page = frame().page();
ASSERT(page);
- CompositedSelectionBound start, end;
+ CompositedSelectionBounds bounds;
LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame());
- if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) {
+ if (!frame || !computeCompositedSelectionBounds(*frame, bounds)) {
page->chrome().client().clearCompositedSelectionBounds();
return;
}
- page->chrome().client().updateCompositedSelectionBounds(start, end);
+ page->chrome().client().updateCompositedSelectionBounds(bounds);
}
bool FrameView::isRubberBandInProgress() const
« no previous file with comments | « no previous file | Source/core/layout/compositing/CompositedSelectionBounds.h » ('j') | Source/web/ChromeClientImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698