OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1663 // If there fixed position elements, scrolling may cause compositing layers
to change. |
1664 // Update widget and layer positions after scrolling, but only if we're not
inside of | 1664 // Update widget and layer positions after scrolling, but only if we're not
inside of |
1665 // layout. | 1665 // layout. |
1666 if (!m_nestedLayoutCount) { | 1666 if (!m_nestedLayoutCount) { |
1667 updateWidgetPositions(); | 1667 updateWidgetPositions(); |
1668 if (RenderView* renderView = this->renderView()) | 1668 if (RenderView* renderView = this->renderView()) |
1669 renderView->layer()->setNeedsCompositingInputsUpdate(); | 1669 renderView->layer()->setNeedsCompositingInputsUpdate(); |
1670 } | 1670 } |
1671 } | 1671 } |
1672 | 1672 |
1673 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe
lectionBound& start, CompositedSelectionBound& end) | 1673 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe
lectionBounds& bounds) |
1674 { | 1674 { |
1675 const VisibleSelection &selection = frame.selection().selection(); | 1675 const VisibleSelection &selection = frame.selection().selection(); |
1676 if (!selection.isCaretOrRange()) | 1676 if (!selection.isCaretOrRange()) |
1677 return false; | 1677 return false; |
1678 | 1678 |
1679 VisiblePosition visibleStart(selection.visibleStart()); | 1679 VisiblePosition visibleStart(selection.visibleStart()); |
1680 VisiblePosition visibleEnd(selection.visibleEnd()); | 1680 VisiblePosition visibleEnd(selection.visibleEnd()); |
1681 | 1681 |
1682 RenderedPosition renderedStart(visibleStart); | 1682 RenderedPosition renderedStart(visibleStart); |
1683 RenderedPosition renderedEnd(visibleEnd); | 1683 RenderedPosition renderedEnd(visibleEnd); |
1684 | 1684 |
1685 renderedStart.positionInGraphicsLayerBacking(start); | 1685 renderedStart.positionInGraphicsLayerBacking(bounds.start); |
1686 if (!start.layer) | 1686 if (!bounds.start.layer) |
1687 return false; | 1687 return false; |
1688 | 1688 |
1689 renderedEnd.positionInGraphicsLayerBacking(end); | 1689 renderedEnd.positionInGraphicsLayerBacking(bounds.end); |
1690 if (!end.layer) | 1690 if (!bounds.end.layer) |
1691 return false; | 1691 return false; |
1692 | 1692 |
| 1693 bounds.isEditable = selection.hasEditableStyle(); |
| 1694 bounds.isUserTriggered = selection.(); |
| 1695 |
1693 if (selection.isCaret()) { | 1696 if (selection.isCaret()) { |
1694 start.type = end.type = CompositedSelectionBound::Caret; | 1697 bounds.start.type = bounds.end.type = CompositedSelectionBound::Caret; |
1695 return true; | 1698 return true; |
1696 } | 1699 } |
1697 | 1700 |
1698 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | 1701 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); |
1699 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | 1702 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); |
1700 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co
mpositedSelectionBound::SelectionLeft; | 1703 bounds.start.type = startDir == RTL ? CompositedSelectionBound::SelectionRig
ht : CompositedSelectionBound::SelectionLeft; |
1701 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi
tedSelectionBound::SelectionRight; | 1704 bounds.end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft :
CompositedSelectionBound::SelectionRight; |
1702 return true; | 1705 return true; |
1703 } | 1706 } |
1704 | 1707 |
1705 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1708 void FrameView::updateCompositedSelectionBoundsIfNeeded() |
1706 { | 1709 { |
1707 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1710 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
1708 return; | 1711 return; |
1709 | 1712 |
1710 Page* page = frame().page(); | 1713 Page* page = frame().page(); |
1711 ASSERT(page); | 1714 ASSERT(page); |
1712 | 1715 |
1713 CompositedSelectionBound start, end; | 1716 CompositedSelectionBounds bounds; |
1714 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); | 1717 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); |
1715 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { | 1718 if (!frame || !computeCompositedSelectionBounds(*frame, bounds)) { |
1716 page->chrome().client().clearCompositedSelectionBounds(); | 1719 page->chrome().client().clearCompositedSelectionBounds(); |
1717 return; | 1720 return; |
1718 } | 1721 } |
1719 | 1722 |
1720 page->chrome().client().updateCompositedSelectionBounds(start, end); | 1723 page->chrome().client().updateCompositedSelectionBounds(bounds); |
1721 } | 1724 } |
1722 | 1725 |
1723 bool FrameView::isRubberBandInProgress() const | 1726 bool FrameView::isRubberBandInProgress() const |
1724 { | 1727 { |
1725 if (scrollbarsSuppressed()) | 1728 if (scrollbarsSuppressed()) |
1726 return false; | 1729 return false; |
1727 | 1730 |
1728 // If the main thread updates the scroll position for this FrameView, we sho
uld return | 1731 // If the main thread updates the scroll position for this FrameView, we sho
uld return |
1729 // ScrollAnimator::isRubberBandInProgress(). | 1732 // ScrollAnimator::isRubberBandInProgress(). |
1730 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 1733 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4051 { | 4054 { |
4052 Settings* settings = frame().settings(); | 4055 Settings* settings = frame().settings(); |
4053 if (!settings || !settings->rootLayerScrolls()) | 4056 if (!settings || !settings->rootLayerScrolls()) |
4054 return this; | 4057 return this; |
4055 | 4058 |
4056 RenderView* renderView = this->renderView(); | 4059 RenderView* renderView = this->renderView(); |
4057 return renderView ? renderView->scrollableArea() : nullptr; | 4060 return renderView ? renderView->scrollableArea() : nullptr; |
4058 } | 4061 } |
4059 | 4062 |
4060 } // namespace blink | 4063 } // namespace blink |
OLD | NEW |