Chromium Code Reviews| 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/CompositedSelectionBounds.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 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 // If there fixed position elements, scrolling may cause compositing layers to change. | 1639 // If there fixed position elements, scrolling may cause compositing layers to change. |
| 1639 // Update widget and layer positions after scrolling, but only if we're not inside of | 1640 // Update widget and layer positions after scrolling, but only if we're not inside of |
| 1640 // layout. | 1641 // layout. |
| 1641 if (!m_nestedLayoutCount) { | 1642 if (!m_nestedLayoutCount) { |
| 1642 updateWidgetPositions(); | 1643 updateWidgetPositions(); |
| 1643 if (LayoutView* layoutView = this->layoutView()) | 1644 if (LayoutView* layoutView = this->layoutView()) |
| 1644 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1645 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
| 1645 } | 1646 } |
| 1646 } | 1647 } |
| 1647 | 1648 |
| 1648 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe lectionBound& start, CompositedSelectionBound& end) | 1649 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe lectionBounds& bounds) |
| 1649 { | 1650 { |
| 1650 const VisibleSelection &selection = frame.selection().selection(); | 1651 const VisibleSelection &selection = frame.selection().selection(); |
| 1651 if (!selection.isCaretOrRange()) | 1652 if (!selection.isCaretOrRange()) |
| 1652 return false; | 1653 return false; |
| 1653 | 1654 |
| 1654 VisiblePosition visibleStart(selection.visibleStart()); | 1655 VisiblePosition visibleStart(selection.visibleStart()); |
| 1655 VisiblePosition visibleEnd(selection.visibleEnd()); | 1656 VisiblePosition visibleEnd(selection.visibleEnd()); |
| 1656 | 1657 |
| 1657 RenderedPosition renderedStart(visibleStart); | 1658 RenderedPosition renderedStart(visibleStart); |
| 1658 RenderedPosition renderedEnd(visibleEnd); | 1659 RenderedPosition renderedEnd(visibleEnd); |
| 1659 | 1660 |
| 1660 renderedStart.positionInGraphicsLayerBacking(start); | 1661 renderedStart.positionInGraphicsLayerBacking(bounds.start); |
| 1661 if (!start.layer) | 1662 if (!bounds.start.layer) |
| 1662 return false; | 1663 return false; |
| 1663 | 1664 |
| 1664 renderedEnd.positionInGraphicsLayerBacking(end); | 1665 renderedEnd.positionInGraphicsLayerBacking(bounds.end); |
| 1665 if (!end.layer) | 1666 if (!bounds.end.layer) |
| 1666 return false; | 1667 return false; |
| 1667 | 1668 |
| 1669 bounds.isEditable = selection.isContentEditable(); | |
|
Rick Byers
2015/03/12 19:27:24
does isContentEditable really return true for the
jdduke (slow)
2015/03/16 18:15:41
Hmm, it appears to, yes. One odd thing that I noti
| |
| 1670 if (bounds.isEditable) { | |
| 1671 if (HTMLTextFormControlElement* enclosingTextFormControlElement = enclos ingTextFormControl(selection.rootEditableElement())) | |
| 1672 bounds.isEditableRegionEmpty = enclosingTextFormControlElement->valu e().isEmpty(); | |
|
jdduke (slow)
2015/03/12 18:18:38
If there's a better way of determining this, pleas
Rick Byers
2015/03/12 19:27:23
not sure off hand. yosin@?
Does this handle the
yosin_UTC9
2015/03/13 02:06:37
Short answer is "yes". Long answer is "case by cas
jdduke (slow)
2015/03/16 18:15:41
Sure. We need to know whether to display a text in
yosin_UTC9
2015/03/18 05:15:41
How about calling |isContentEdtiable()| if |select
jdduke (slow)
2015/03/18 20:20:45
That's one option. I think what we want is for thi
| |
| 1673 } | |
| 1674 | |
| 1668 if (selection.isCaret()) { | 1675 if (selection.isCaret()) { |
| 1669 start.type = end.type = CompositedSelectionBound::Caret; | 1676 bounds.start.type = bounds.end.type = CompositedSelectionBound::Caret; |
| 1670 return true; | 1677 return true; |
| 1671 } | 1678 } |
| 1672 | 1679 |
| 1673 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | 1680 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); |
| 1674 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | 1681 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); |
| 1675 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co mpositedSelectionBound::SelectionLeft; | 1682 bounds.start.type = startDir == RTL ? CompositedSelectionBound::SelectionRig ht : CompositedSelectionBound::SelectionLeft; |
| 1676 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi tedSelectionBound::SelectionRight; | 1683 bounds.end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : CompositedSelectionBound::SelectionRight; |
| 1677 return true; | 1684 return true; |
| 1678 } | 1685 } |
| 1679 | 1686 |
| 1680 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1687 void FrameView::updateCompositedSelectionBoundsIfNeeded() |
| 1681 { | 1688 { |
| 1682 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1689 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
| 1683 return; | 1690 return; |
| 1684 | 1691 |
| 1685 Page* page = frame().page(); | 1692 Page* page = frame().page(); |
| 1686 ASSERT(page); | 1693 ASSERT(page); |
| 1687 | 1694 |
| 1688 CompositedSelectionBound start, end; | 1695 CompositedSelectionBounds bounds; |
| 1689 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); | 1696 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); |
| 1690 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { | 1697 if (!frame || !computeCompositedSelectionBounds(*frame, bounds)) { |
| 1691 page->chrome().client().clearCompositedSelectionBounds(); | 1698 page->chrome().client().clearCompositedSelectionBounds(); |
| 1692 return; | 1699 return; |
| 1693 } | 1700 } |
| 1694 | 1701 |
| 1695 page->chrome().client().updateCompositedSelectionBounds(start, end); | 1702 page->chrome().client().updateCompositedSelectionBounds(bounds); |
| 1696 } | 1703 } |
| 1697 | 1704 |
| 1698 HostWindow* FrameView::hostWindow() const | 1705 HostWindow* FrameView::hostWindow() const |
| 1699 { | 1706 { |
| 1700 Page* page = frame().page(); | 1707 Page* page = frame().page(); |
| 1701 if (!page) | 1708 if (!page) |
| 1702 return nullptr; | 1709 return nullptr; |
| 1703 return &page->chrome(); | 1710 return &page->chrome(); |
| 1704 } | 1711 } |
| 1705 | 1712 |
| (...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4027 { | 4034 { |
| 4028 Settings* settings = frame().settings(); | 4035 Settings* settings = frame().settings(); |
| 4029 if (!settings || !settings->rootLayerScrolls()) | 4036 if (!settings || !settings->rootLayerScrolls()) |
| 4030 return this; | 4037 return this; |
| 4031 | 4038 |
| 4032 LayoutView* layoutView = this->layoutView(); | 4039 LayoutView* layoutView = this->layoutView(); |
| 4033 return layoutView ? layoutView->scrollableArea() : nullptr; | 4040 return layoutView ? layoutView->scrollableArea() : nullptr; |
| 4034 } | 4041 } |
| 4035 | 4042 |
| 4036 } // namespace blink | 4043 } // namespace blink |
| OLD | NEW |