| Index: Source/core/frame/FrameView.cpp
|
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
|
| index c351dbc47c26dc0e4603b0af83d53aed93327f77..4ccf6fa6a44db289cd5ef2498e7660aa4681b8d0 100644
|
| --- a/Source/core/frame/FrameView.cpp
|
| +++ b/Source/core/frame/FrameView.cpp
|
| @@ -44,6 +44,7 @@
|
| #include "core/frame/Settings.h"
|
| #include "core/html/HTMLFrameElement.h"
|
| #include "core/html/HTMLPlugInElement.h"
|
| +#include "core/html/HTMLTextFormControlElement.h"
|
| #include "core/html/parser/TextResourceDecoder.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| #include "core/inspector/InspectorTraceEvents.h"
|
| @@ -57,7 +58,7 @@
|
| #include "core/layout/LayoutView.h"
|
| #include "core/layout/TextAutosizer.h"
|
| #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
|
| -#include "core/layout/compositing/CompositedSelectionBound.h"
|
| +#include "core/layout/compositing/CompositedSelection.h"
|
| #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
|
| #include "core/layout/style/LayoutStyle.h"
|
| #include "core/layout/svg/LayoutSVGRoot.h"
|
| @@ -1651,39 +1652,40 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
|
| }
|
| }
|
|
|
| -bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSelectionBound& start, CompositedSelectionBound& end)
|
| +bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelection& selection)
|
| {
|
| - const VisibleSelection &selection = frame.selection().selection();
|
| - if (!selection.isCaretOrRange())
|
| + const VisibleSelection& visibleSelection = frame.selection().selection();
|
| + if (!visibleSelection.isCaretOrRange())
|
| return false;
|
|
|
| - VisiblePosition visibleStart(selection.visibleStart());
|
| - VisiblePosition visibleEnd(selection.visibleEnd());
|
| + VisiblePosition visibleBase(visibleSelection.visibleBase());
|
| + VisiblePosition visibleExtent(visibleSelection.visibleExtent());
|
|
|
| - RenderedPosition renderedStart(visibleStart);
|
| - RenderedPosition renderedEnd(visibleEnd);
|
| + RenderedPosition renderedBase(visibleBase);
|
| + RenderedPosition renderedExtent(visibleExtent);
|
|
|
| - renderedStart.positionInGraphicsLayerBacking(start);
|
| - if (!start.layer)
|
| + renderedBase.positionInGraphicsLayerBacking(selection.base);
|
| + if (!selection.base.layer)
|
| return false;
|
|
|
| - renderedEnd.positionInGraphicsLayerBacking(end);
|
| - if (!end.layer)
|
| + renderedExtent.positionInGraphicsLayerBacking(selection.extent);
|
| + if (!selection.extent.layer)
|
| return false;
|
|
|
| - if (selection.isCaret()) {
|
| - start.type = end.type = CompositedSelectionBound::Caret;
|
| - return true;
|
| + selection.type = visibleSelection.selectionType();
|
| + selection.isBaseFirst = visibleSelection.isBaseFirst();
|
| + selection.isEditable = visibleSelection.isContentEditable();
|
| + if (selection.isEditable) {
|
| + if (HTMLTextFormControlElement* enclosingTextFormControlElement = enclosingTextFormControl(visibleSelection.rootEditableElement()))
|
| + selection.isEmptyTextFormControl = enclosingTextFormControlElement->value().isEmpty();
|
| }
|
| + selection.base.isTextDirectionRTL = visibleBase.deepEquivalent().primaryDirection() == RTL;
|
| + selection.extent.isTextDirectionRTL = visibleExtent.deepEquivalent().primaryDirection() == RTL;
|
|
|
| - 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;
|
| return true;
|
| }
|
|
|
| -void FrameView::updateCompositedSelectionBoundsIfNeeded()
|
| +void FrameView::updateCompositedSelectionIfNeeded()
|
| {
|
| if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled())
|
| return;
|
| @@ -1691,14 +1693,14 @@ void FrameView::updateCompositedSelectionBoundsIfNeeded()
|
| Page* page = frame().page();
|
| ASSERT(page);
|
|
|
| - CompositedSelectionBound start, end;
|
| + CompositedSelection selection;
|
| LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame());
|
| - if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) {
|
| - page->chrome().client().clearCompositedSelectionBounds();
|
| + if (!frame || !computeCompositedSelection(*frame, selection)) {
|
| + page->chrome().client().clearCompositedSelection();
|
| return;
|
| }
|
|
|
| - page->chrome().client().updateCompositedSelectionBounds(start, end);
|
| + page->chrome().client().updateCompositedSelection(selection);
|
| }
|
|
|
| HostWindow* FrameView::hostWindow() const
|
| @@ -2539,7 +2541,7 @@ void FrameView::updateLayoutAndStyleForPainting()
|
| if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
|
| scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
|
|
|
| - updateCompositedSelectionBoundsIfNeeded();
|
| + updateCompositedSelectionIfNeeded();
|
|
|
| scrollContentsIfNeededRecursive();
|
|
|
|
|