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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/frame/FrameView.h" | 28 #include "core/frame/FrameView.h" |
| 29 | 29 |
| 30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
| 31 #include "core/accessibility/AXObjectCache.h" | 31 #include "core/accessibility/AXObjectCache.h" |
| 32 #include "core/css/FontFaceSet.h" | 32 #include "core/css/FontFaceSet.h" |
| 33 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/dom/DocumentMarkerController.h" | 34 #include "core/dom/DocumentMarkerController.h" |
| 35 #include "core/editing/FrameSelection.h" | 35 #include "core/editing/FrameSelection.h" |
| 36 #include "core/editing/RenderedPosition.h" | |
| 36 #include "core/events/OverflowEvent.h" | 37 #include "core/events/OverflowEvent.h" |
| 37 #include "core/fetch/ResourceFetcher.h" | 38 #include "core/fetch/ResourceFetcher.h" |
| 38 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 39 #include "core/frame/FrameHost.h" | 40 #include "core/frame/FrameHost.h" |
| 40 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 42 #include "core/html/HTMLFrameElement.h" | 43 #include "core/html/HTMLFrameElement.h" |
| 43 #include "core/html/HTMLPlugInElement.h" | 44 #include "core/html/HTMLPlugInElement.h" |
| 44 #include "core/html/parser/TextResourceDecoder.h" | 45 #include "core/html/parser/TextResourceDecoder.h" |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 46 #include "core/inspector/InspectorInstrumentation.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 58 #include "core/rendering/RenderLayer.h" | 59 #include "core/rendering/RenderLayer.h" |
| 59 #include "core/rendering/RenderListBox.h" | 60 #include "core/rendering/RenderListBox.h" |
| 60 #include "core/rendering/RenderPart.h" | 61 #include "core/rendering/RenderPart.h" |
| 61 #include "core/rendering/RenderScrollbar.h" | 62 #include "core/rendering/RenderScrollbar.h" |
| 62 #include "core/rendering/RenderScrollbarPart.h" | 63 #include "core/rendering/RenderScrollbarPart.h" |
| 63 #include "core/rendering/RenderTheme.h" | 64 #include "core/rendering/RenderTheme.h" |
| 64 #include "core/rendering/RenderView.h" | 65 #include "core/rendering/RenderView.h" |
| 65 #include "core/rendering/RenderWidget.h" | 66 #include "core/rendering/RenderWidget.h" |
| 66 #include "core/rendering/TextAutosizer.h" | 67 #include "core/rendering/TextAutosizer.h" |
| 67 #include "core/rendering/compositing/CompositedLayerMapping.h" | 68 #include "core/rendering/compositing/CompositedLayerMapping.h" |
| 69 #include "core/rendering/compositing/CompositedSelectionBound.h" | |
| 68 #include "core/rendering/compositing/RenderLayerCompositor.h" | 70 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 69 #include "core/rendering/style/RenderStyle.h" | 71 #include "core/rendering/style/RenderStyle.h" |
| 70 #include "core/rendering/svg/RenderSVGRoot.h" | 72 #include "core/rendering/svg/RenderSVGRoot.h" |
| 71 #include "core/svg/SVGDocumentExtensions.h" | 73 #include "core/svg/SVGDocumentExtensions.h" |
| 72 #include "core/svg/SVGSVGElement.h" | 74 #include "core/svg/SVGSVGElement.h" |
| 73 #include "platform/RuntimeEnabledFeatures.h" | 75 #include "platform/RuntimeEnabledFeatures.h" |
| 74 #include "platform/ScriptForbiddenScope.h" | 76 #include "platform/ScriptForbiddenScope.h" |
| 75 #include "platform/TraceEvent.h" | 77 #include "platform/TraceEvent.h" |
| 76 #include "platform/fonts/FontCache.h" | 78 #include "platform/fonts/FontCache.h" |
| 77 #include "platform/geometry/FloatRect.h" | 79 #include "platform/geometry/FloatRect.h" |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1565 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 1564 | 1566 |
| 1565 // Don't need to do this for composited fixed items. | 1567 // Don't need to do this for composited fixed items. |
| 1566 if (layer->compositingState() == PaintsIntoOwnBacking) | 1568 if (layer->compositingState() == PaintsIntoOwnBacking) |
| 1567 continue; | 1569 continue; |
| 1568 | 1570 |
| 1569 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants(); | 1571 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants(); |
| 1570 } | 1572 } |
| 1571 } | 1573 } |
| 1572 | 1574 |
| 1575 static bool computeCompositedSelectionBounds(LocalFrame& frame, CompositedSelect ionBound& start, CompositedSelectionBound& end) | |
|
chrishtr
2014/09/05 22:14:56
Make this a static member method of FrameView.
trchen
2014/09/06 00:06:26
Acknowledged.
| |
| 1576 { | |
| 1577 const VisibleSelection &selection = frame.selection().selection(); | |
| 1578 if (!selection.isCaretOrRange()) | |
| 1579 return false; | |
| 1580 | |
| 1581 VisiblePosition visibleStart(selection.visibleStart()); | |
| 1582 VisiblePosition visibleEnd(selection.visibleEnd()); | |
| 1583 | |
| 1584 RenderedPosition renderedStart(visibleStart); | |
| 1585 RenderedPosition renderedEnd(visibleEnd); | |
| 1586 FloatPoint edgeTop, edgeBottom; | |
| 1587 | |
| 1588 renderedStart.layerPoints(start.layer, start.edgeTopInLayer, start.edgeBotto mInLayer); | |
| 1589 renderedEnd.layerPoints(end.layer, end.edgeTopInLayer, end.edgeBottomInLayer ); | |
| 1590 | |
| 1591 if (selection.isCaret()) { | |
| 1592 start.type = end.type = CompositedSelectionBound::Caret; | |
| 1593 return true; | |
| 1594 } | |
| 1595 | |
| 1596 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | |
| 1597 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | |
| 1598 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co mpositedSelectionBound::SelectionLeft; | |
| 1599 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi tedSelectionBound::SelectionRight; | |
| 1600 return true; | |
| 1601 } | |
| 1602 | |
| 1573 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1603 void FrameView::updateCompositedSelectionBoundsIfNeeded() |
| 1574 { | 1604 { |
| 1575 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) | 1605 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) |
| 1576 return; | 1606 return; |
| 1577 | 1607 |
| 1578 Page* page = frame().page(); | 1608 Page* page = frame().page(); |
| 1579 ASSERT(page); | 1609 ASSERT(page); |
| 1580 | 1610 |
| 1611 CompositedSelectionBound start, end; | |
| 1581 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); | 1612 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); |
| 1582 if (!frame || !frame->selection().isCaretOrRange()) { | 1613 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { |
| 1583 page->chrome().client().clearCompositedSelectionBounds(); | 1614 page->chrome().client().clearCompositedSelectionBounds(); |
| 1584 return; | 1615 return; |
| 1585 } | 1616 } |
| 1586 | 1617 |
| 1587 // TODO(jdduke): Compute and route selection bounds through ChromeClient. | 1618 page->chrome().client().updateCompositedSelectionBounds(start, end); |
| 1588 } | 1619 } |
| 1589 | 1620 |
| 1590 bool FrameView::isRubberBandInProgress() const | 1621 bool FrameView::isRubberBandInProgress() const |
| 1591 { | 1622 { |
| 1592 if (scrollbarsSuppressed()) | 1623 if (scrollbarsSuppressed()) |
| 1593 return false; | 1624 return false; |
| 1594 | 1625 |
| 1595 // If the main thread updates the scroll position for this FrameView, we sho uld return | 1626 // If the main thread updates the scroll position for this FrameView, we sho uld return |
| 1596 // ScrollAnimator::isRubberBandInProgress(). | 1627 // ScrollAnimator::isRubberBandInProgress(). |
| 1597 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 1628 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3020 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3051 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3021 { | 3052 { |
| 3022 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3053 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3023 if (AXObjectCache* cache = axObjectCache()) { | 3054 if (AXObjectCache* cache = axObjectCache()) { |
| 3024 cache->remove(scrollbar); | 3055 cache->remove(scrollbar); |
| 3025 cache->handleScrollbarUpdate(this); | 3056 cache->handleScrollbarUpdate(this); |
| 3026 } | 3057 } |
| 3027 } | 3058 } |
| 3028 | 3059 |
| 3029 } // namespace blink | 3060 } // namespace blink |
| OLD | NEW |