| 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/LayoutAnalyzer.h" | 51 #include "core/layout/LayoutAnalyzer.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/CompositedDeprecatedPaintLayerMapping.h" | 61 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
| 61 #include "core/layout/compositing/CompositedSelectionBound.h" | 62 #include "core/layout/compositing/CompositedSelection.h" |
| 62 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 63 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| 63 #include "core/style/ComputedStyle.h" | 64 #include "core/style/ComputedStyle.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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1666 // If there fixed position elements, scrolling may cause compositing layers
to change. |
| 1666 // Update widget and layer positions after scrolling, but only if we're not
inside of | 1667 // Update widget and layer positions after scrolling, but only if we're not
inside of |
| 1667 // layout. | 1668 // layout. |
| 1668 if (!m_nestedLayoutCount) { | 1669 if (!m_nestedLayoutCount) { |
| 1669 updateWidgetPositions(); | 1670 updateWidgetPositions(); |
| 1670 if (LayoutView* layoutView = this->layoutView()) | 1671 if (LayoutView* layoutView = this->layoutView()) |
| 1671 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1672 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
| 1672 } | 1673 } |
| 1673 } | 1674 } |
| 1674 | 1675 |
| 1675 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe
lectionBound& start, CompositedSelectionBound& end) | 1676 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio
n& selection) |
| 1676 { | 1677 { |
| 1677 const VisibleSelection &selection = frame.selection().selection(); | 1678 const VisibleSelection& visibleSelection = frame.selection().selection(); |
| 1678 if (!selection.isCaretOrRange()) | 1679 if (!visibleSelection.isCaretOrRange()) |
| 1679 return false; | 1680 return false; |
| 1680 | 1681 |
| 1681 VisiblePosition visibleStart(selection.visibleStart()); | 1682 VisiblePosition visibleStart(visibleSelection.visibleStart()); |
| 1682 VisiblePosition visibleEnd(selection.visibleEnd()); | 1683 VisiblePosition visibleEnd(visibleSelection.visibleEnd()); |
| 1683 | 1684 |
| 1684 RenderedPosition renderedStart(visibleStart); | 1685 RenderedPosition renderedStart(visibleStart); |
| 1685 RenderedPosition renderedEnd(visibleEnd); | 1686 RenderedPosition renderedEnd(visibleEnd); |
| 1686 | 1687 |
| 1687 renderedStart.positionInGraphicsLayerBacking(start); | 1688 renderedStart.positionInGraphicsLayerBacking(selection.start); |
| 1688 if (!start.layer) | 1689 if (!selection.start.layer) |
| 1689 return false; | 1690 return false; |
| 1690 | 1691 |
| 1691 renderedEnd.positionInGraphicsLayerBacking(end); | 1692 renderedEnd.positionInGraphicsLayerBacking(selection.end); |
| 1692 if (!end.layer) | 1693 if (!selection.end.layer) |
| 1693 return false; | 1694 return false; |
| 1694 | 1695 |
| 1695 if (selection.isCaret()) { | 1696 selection.type = visibleSelection.selectionType(); |
| 1696 start.type = end.type = CompositedSelectionBound::Caret; | 1697 selection.isEditable = visibleSelection.isContentEditable(); |
| 1697 return true; | 1698 if (selection.isEditable) { |
| 1699 if (HTMLTextFormControlElement* enclosingTextFormControlElement = enclos
ingTextFormControl(visibleSelection.rootEditableElement())) |
| 1700 selection.isEmptyTextFormControl = enclosingTextFormControlElement->
value().isEmpty(); |
| 1698 } | 1701 } |
| 1702 selection.start.isTextDirectionRTL = visibleStart.deepEquivalent().primaryDi
rection() == RTL; |
| 1703 selection.end.isTextDirectionRTL = visibleEnd.deepEquivalent().primaryDirect
ion() == RTL; |
| 1699 | 1704 |
| 1700 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | |
| 1701 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | |
| 1702 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co
mpositedSelectionBound::SelectionLeft; | |
| 1703 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi
tedSelectionBound::SelectionRight; | |
| 1704 return true; | 1705 return true; |
| 1705 } | 1706 } |
| 1706 | 1707 |
| 1707 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1708 void FrameView::updateCompositedSelectionIfNeeded() |
| 1708 { | 1709 { |
| 1709 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1710 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
| 1710 return; | 1711 return; |
| 1711 | 1712 |
| 1712 Page* page = frame().page(); | 1713 Page* page = frame().page(); |
| 1713 ASSERT(page); | 1714 ASSERT(page); |
| 1714 | 1715 |
| 1715 CompositedSelectionBound start, end; | 1716 CompositedSelection selection; |
| 1716 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); | 1717 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); |
| 1717 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { | 1718 if (!frame || !computeCompositedSelection(*frame, selection)) { |
| 1718 page->chrome().client().clearCompositedSelectionBounds(); | 1719 page->chrome().client().clearCompositedSelection(); |
| 1719 return; | 1720 return; |
| 1720 } | 1721 } |
| 1721 | 1722 |
| 1722 page->chrome().client().updateCompositedSelectionBounds(start, end); | 1723 page->chrome().client().updateCompositedSelection(selection); |
| 1723 } | 1724 } |
| 1724 | 1725 |
| 1725 HostWindow* FrameView::hostWindow() const | 1726 HostWindow* FrameView::hostWindow() const |
| 1726 { | 1727 { |
| 1727 Page* page = frame().page(); | 1728 Page* page = frame().page(); |
| 1728 if (!page) | 1729 if (!page) |
| 1729 return nullptr; | 1730 return nullptr; |
| 1730 return &page->chrome(); | 1731 return &page->chrome(); |
| 1731 } | 1732 } |
| 1732 | 1733 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 | 2571 |
| 2571 LayoutView* view = layoutView(); | 2572 LayoutView* view = layoutView(); |
| 2572 if (view) { | 2573 if (view) { |
| 2573 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); | 2574 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
| 2574 | 2575 |
| 2575 view->compositor()->updateIfNeededRecursive(); | 2576 view->compositor()->updateIfNeededRecursive(); |
| 2576 | 2577 |
| 2577 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2578 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
| 2578 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2579 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| 2579 | 2580 |
| 2580 updateCompositedSelectionBoundsIfNeeded(); | 2581 updateCompositedSelectionIfNeeded(); |
| 2581 | 2582 |
| 2582 scrollContentsIfNeededRecursive(); | 2583 scrollContentsIfNeededRecursive(); |
| 2583 | 2584 |
| 2584 invalidateTreeIfNeededRecursive(); | 2585 invalidateTreeIfNeededRecursive(); |
| 2585 | 2586 |
| 2586 ASSERT(!view->hasPendingSelection()); | 2587 ASSERT(!view->hasPendingSelection()); |
| 2587 } | 2588 } |
| 2588 | 2589 |
| 2589 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2590 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
| 2590 } | 2591 } |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4091 { | 4092 { |
| 4092 Settings* settings = frame().settings(); | 4093 Settings* settings = frame().settings(); |
| 4093 if (!settings || !settings->rootLayerScrolls()) | 4094 if (!settings || !settings->rootLayerScrolls()) |
| 4094 return this; | 4095 return this; |
| 4095 | 4096 |
| 4096 LayoutView* layoutView = this->layoutView(); | 4097 LayoutView* layoutView = this->layoutView(); |
| 4097 return layoutView ? layoutView->scrollableArea() : nullptr; | 4098 return layoutView ? layoutView->scrollableArea() : nullptr; |
| 4098 } | 4099 } |
| 4099 | 4100 |
| 4100 } // namespace blink | 4101 } // namespace blink |
| OLD | NEW |