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 26 matching lines...) Expand all Loading... | |
37 #include "core/editing/FrameSelection.h" | 37 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/RenderedPosition.h" | 38 #include "core/editing/RenderedPosition.h" |
39 #include "core/events/OverflowEvent.h" | 39 #include "core/events/OverflowEvent.h" |
40 #include "core/fetch/ResourceFetcher.h" | 40 #include "core/fetch/ResourceFetcher.h" |
41 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 41 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
42 #include "core/frame/FrameHost.h" | 42 #include "core/frame/FrameHost.h" |
43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
44 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
45 #include "core/html/HTMLFrameElement.h" | 45 #include "core/html/HTMLFrameElement.h" |
46 #include "core/html/HTMLPlugInElement.h" | 46 #include "core/html/HTMLPlugInElement.h" |
47 #include "core/html/HTMLTextFormControlElement.h" | |
47 #include "core/html/parser/TextResourceDecoder.h" | 48 #include "core/html/parser/TextResourceDecoder.h" |
48 #include "core/inspector/InspectorInstrumentation.h" | 49 #include "core/inspector/InspectorInstrumentation.h" |
49 #include "core/inspector/InspectorTraceEvents.h" | 50 #include "core/inspector/InspectorTraceEvents.h" |
50 #include "core/layout/Layer.h" | 51 #include "core/layout/Layer.h" |
51 #include "core/layout/LayoutCounter.h" | 52 #include "core/layout/LayoutCounter.h" |
52 #include "core/layout/LayoutEmbeddedObject.h" | 53 #include "core/layout/LayoutEmbeddedObject.h" |
53 #include "core/layout/LayoutListBox.h" | 54 #include "core/layout/LayoutListBox.h" |
54 #include "core/layout/LayoutPart.h" | 55 #include "core/layout/LayoutPart.h" |
55 #include "core/layout/LayoutScrollbar.h" | 56 #include "core/layout/LayoutScrollbar.h" |
56 #include "core/layout/LayoutScrollbarPart.h" | 57 #include "core/layout/LayoutScrollbarPart.h" |
57 #include "core/layout/LayoutTheme.h" | 58 #include "core/layout/LayoutTheme.h" |
58 #include "core/layout/LayoutView.h" | 59 #include "core/layout/LayoutView.h" |
59 #include "core/layout/TextAutosizer.h" | 60 #include "core/layout/TextAutosizer.h" |
60 #include "core/layout/compositing/CompositedLayerMapping.h" | 61 #include "core/layout/compositing/CompositedLayerMapping.h" |
61 #include "core/layout/compositing/CompositedSelectionBound.h" | 62 #include "core/layout/compositing/CompositedSelection.h" |
62 #include "core/layout/compositing/LayerCompositor.h" | 63 #include "core/layout/compositing/LayerCompositor.h" |
63 #include "core/layout/style/LayoutStyle.h" | 64 #include "core/layout/style/LayoutStyle.h" |
64 #include "core/layout/svg/LayoutSVGRoot.h" | 65 #include "core/layout/svg/LayoutSVGRoot.h" |
65 #include "core/loader/FrameLoader.h" | 66 #include "core/loader/FrameLoader.h" |
66 #include "core/loader/FrameLoaderClient.h" | 67 #include "core/loader/FrameLoaderClient.h" |
67 #include "core/page/Chrome.h" | 68 #include "core/page/Chrome.h" |
68 #include "core/page/ChromeClient.h" | 69 #include "core/page/ChromeClient.h" |
69 #include "core/page/EventHandler.h" | 70 #include "core/page/EventHandler.h" |
70 #include "core/page/FocusController.h" | 71 #include "core/page/FocusController.h" |
71 #include "core/page/FrameTree.h" | 72 #include "core/page/FrameTree.h" |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1644 // If there fixed position elements, scrolling may cause compositing layers to change. | 1645 // If there fixed position elements, scrolling may cause compositing layers to change. |
1645 // Update widget and layer positions after scrolling, but only if we're not inside of | 1646 // Update widget and layer positions after scrolling, but only if we're not inside of |
1646 // layout. | 1647 // layout. |
1647 if (!m_nestedLayoutCount) { | 1648 if (!m_nestedLayoutCount) { |
1648 updateWidgetPositions(); | 1649 updateWidgetPositions(); |
1649 if (LayoutView* layoutView = this->layoutView()) | 1650 if (LayoutView* layoutView = this->layoutView()) |
1650 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1651 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
1651 } | 1652 } |
1652 } | 1653 } |
1653 | 1654 |
1654 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe lectionBound& start, CompositedSelectionBound& end) | 1655 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio n& selection) |
1655 { | 1656 { |
1656 const VisibleSelection &selection = frame.selection().selection(); | 1657 const VisibleSelection& visibleSelection = frame.selection().selection(); |
1657 if (!selection.isCaretOrRange()) | 1658 if (!visibleSelection.isCaretOrRange()) |
1658 return false; | 1659 return false; |
1659 | 1660 |
1660 VisiblePosition visibleStart(selection.visibleStart()); | 1661 VisiblePosition visibleBase(visibleSelection.visibleBase()); |
1661 VisiblePosition visibleEnd(selection.visibleEnd()); | 1662 VisiblePosition visibleExtent(visibleSelection.visibleExtent()); |
1662 | 1663 |
1663 RenderedPosition renderedStart(visibleStart); | 1664 RenderedPosition renderedBase(visibleBase); |
1664 RenderedPosition renderedEnd(visibleEnd); | 1665 RenderedPosition renderedExtent(visibleExtent); |
1665 | 1666 |
1666 renderedStart.positionInGraphicsLayerBacking(start); | 1667 renderedBase.positionInGraphicsLayerBacking(selection.base); |
1667 if (!start.layer) | 1668 if (!selection.base.layer) |
1668 return false; | 1669 return false; |
1669 | 1670 |
1670 renderedEnd.positionInGraphicsLayerBacking(end); | 1671 renderedExtent.positionInGraphicsLayerBacking(selection.extent); |
1671 if (!end.layer) | 1672 if (!selection.extent.layer) |
1672 return false; | 1673 return false; |
1673 | 1674 |
1674 if (selection.isCaret()) { | 1675 selection.type = visibleSelection.selectionType(); |
1675 start.type = end.type = CompositedSelectionBound::Caret; | 1676 selection.isBaseFirst = visibleSelection.isBaseFirst(); |
1676 return true; | 1677 selection.isEditable = visibleSelection.isContentEditable(); |
1678 if (selection.isEditable) { | |
1679 if (HTMLTextFormControlElement* enclosingTextFormControlElement = enclos ingTextFormControl(visibleSelection.rootEditableElement())) | |
1680 selection.isEditableRegionEmpty = enclosingTextFormControlElement->v alue().isEmpty(); | |
yoichio
2015/03/20 05:17:51
How about <div isContentEditable=true></div>? That
jdduke (slow)
2015/03/20 15:02:18
You're right.
I think it's OK if we make this "be
| |
1677 } | 1681 } |
1682 selection.base.isTextDirectionRTL = visibleBase.deepEquivalent().primaryDire ction() == RTL; | |
1683 selection.extent.isTextDirectionRTL = visibleExtent.deepEquivalent().primary Direction() == RTL; | |
1678 | 1684 |
1679 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | |
1680 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | |
1681 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co mpositedSelectionBound::SelectionLeft; | |
1682 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi tedSelectionBound::SelectionRight; | |
1683 return true; | 1685 return true; |
1684 } | 1686 } |
1685 | 1687 |
1686 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1688 void FrameView::updateCompositedSelectionIfNeeded() |
1687 { | 1689 { |
1688 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1690 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
1689 return; | 1691 return; |
1690 | 1692 |
1691 Page* page = frame().page(); | 1693 Page* page = frame().page(); |
1692 ASSERT(page); | 1694 ASSERT(page); |
1693 | 1695 |
1694 CompositedSelectionBound start, end; | 1696 CompositedSelection selection; |
1695 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); | 1697 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); |
1696 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { | 1698 if (!frame || !computeCompositedSelection(*frame, selection)) { |
1697 page->chrome().client().clearCompositedSelectionBounds(); | 1699 page->chrome().client().clearCompositedSelection(); |
1698 return; | 1700 return; |
1699 } | 1701 } |
1700 | 1702 |
1701 page->chrome().client().updateCompositedSelectionBounds(start, end); | 1703 page->chrome().client().updateCompositedSelection(selection); |
1702 } | 1704 } |
1703 | 1705 |
1704 HostWindow* FrameView::hostWindow() const | 1706 HostWindow* FrameView::hostWindow() const |
1705 { | 1707 { |
1706 Page* page = frame().page(); | 1708 Page* page = frame().page(); |
1707 if (!page) | 1709 if (!page) |
1708 return nullptr; | 1710 return nullptr; |
1709 return &page->chrome(); | 1711 return &page->chrome(); |
1710 } | 1712 } |
1711 | 1713 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2532 | 2534 |
2533 LayoutView* view = layoutView(); | 2535 LayoutView* view = layoutView(); |
2534 if (view) { | 2536 if (view) { |
2535 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); | 2537 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
2536 | 2538 |
2537 view->compositor()->updateIfNeededRecursive(); | 2539 view->compositor()->updateIfNeededRecursive(); |
2538 | 2540 |
2539 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2541 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
2540 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2542 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2541 | 2543 |
2542 updateCompositedSelectionBoundsIfNeeded(); | 2544 updateCompositedSelectionIfNeeded(); |
2543 | 2545 |
2544 scrollContentsIfNeededRecursive(); | 2546 scrollContentsIfNeededRecursive(); |
2545 | 2547 |
2546 invalidateTreeIfNeededRecursive(); | 2548 invalidateTreeIfNeededRecursive(); |
2547 | 2549 |
2548 ASSERT(!view->hasPendingSelection()); | 2550 ASSERT(!view->hasPendingSelection()); |
2549 } | 2551 } |
2550 | 2552 |
2551 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2553 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
2552 } | 2554 } |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4033 { | 4035 { |
4034 Settings* settings = frame().settings(); | 4036 Settings* settings = frame().settings(); |
4035 if (!settings || !settings->rootLayerScrolls()) | 4037 if (!settings || !settings->rootLayerScrolls()) |
4036 return this; | 4038 return this; |
4037 | 4039 |
4038 LayoutView* layoutView = this->layoutView(); | 4040 LayoutView* layoutView = this->layoutView(); |
4039 return layoutView ? layoutView->scrollableArea() : nullptr; | 4041 return layoutView ? layoutView->scrollableArea() : nullptr; |
4040 } | 4042 } |
4041 | 4043 |
4042 } // namespace blink | 4044 } // namespace blink |
OLD | NEW |