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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1543 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1545 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 1544 | 1546 |
| 1545 // Don't need to do this for composited fixed items. | 1547 // Don't need to do this for composited fixed items. |
| 1546 if (layer->compositingState() == PaintsIntoOwnBacking) | 1548 if (layer->compositingState() == PaintsIntoOwnBacking) |
| 1547 continue; | 1549 continue; |
| 1548 | 1550 |
| 1549 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants(); | 1551 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants(); |
| 1550 } | 1552 } |
| 1551 } | 1553 } |
| 1552 | 1554 |
| 1555 static bool computeCompositedSelectionBounds(LocalFrame& frame, CompositedSelect ionBound& start, CompositedSelectionBound& end) | |
| 1556 { | |
| 1557 const VisibleSelection &selection = frame.selection().selection(); | |
| 1558 if (!selection.isCaretOrRange()) | |
| 1559 return false; | |
| 1560 | |
| 1561 VisiblePosition visibleStart(selection.visibleStart()); | |
| 1562 VisiblePosition visibleEnd(selection.visibleEnd()); | |
| 1563 | |
| 1564 RenderedPosition renderedStart(visibleStart); | |
| 1565 RenderedPosition renderedEnd(visibleEnd); | |
| 1566 FloatPoint edgeTop, edgeBottom; | |
| 1567 | |
| 1568 renderedStart.layerPoints(start.layer, edgeTop, edgeBottom); | |
| 1569 start.edgeTopInLayer = roundedIntPoint(edgeTop); | |
|
aelias_OOO_until_Jul13
2014/09/03 21:13:48
Please keep these as FloatPoint in CompositedSelec
| |
| 1570 start.edgeBottomInLayer = roundedIntPoint(edgeBottom); | |
| 1571 | |
| 1572 renderedEnd.layerPoints(end.layer, edgeTop, edgeBottom); | |
| 1573 end.edgeTopInLayer = roundedIntPoint(edgeTop); | |
| 1574 end.edgeBottomInLayer = roundedIntPoint(edgeBottom); | |
| 1575 | |
| 1576 if (selection.isCaret()) { | |
| 1577 start.type = end.type = CompositedSelectionBound::Caret; | |
| 1578 return true; | |
| 1579 } | |
| 1580 | |
| 1581 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); | |
| 1582 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); | |
| 1583 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co mpositedSelectionBound::SelectionLeft; | |
| 1584 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi tedSelectionBound::SelectionRight; | |
| 1585 return true; | |
| 1586 } | |
| 1587 | |
| 1553 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1588 void FrameView::updateCompositedSelectionBoundsIfNeeded() |
| 1554 { | 1589 { |
| 1555 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) | 1590 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) |
| 1556 return; | 1591 return; |
| 1557 | 1592 |
| 1558 Page* page = frame().page(); | 1593 Page* page = frame().page(); |
| 1559 ASSERT(page); | 1594 ASSERT(page); |
| 1560 | 1595 |
| 1596 CompositedSelectionBound start, end; | |
| 1561 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); | 1597 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); |
| 1562 if (!frame || !frame->selection().isCaretOrRange()) { | 1598 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { |
| 1563 page->chrome().client().clearCompositedSelectionBounds(); | 1599 page->chrome().client().clearCompositedSelectionBounds(); |
| 1564 return; | 1600 return; |
| 1565 } | 1601 } |
| 1566 | 1602 |
| 1567 // TODO(jdduke): Compute and route selection bounds through ChromeClient. | 1603 page->chrome().client().updateCompositedSelectionBounds(start, end); |
| 1568 } | 1604 } |
| 1569 | 1605 |
| 1570 bool FrameView::isRubberBandInProgress() const | 1606 bool FrameView::isRubberBandInProgress() const |
| 1571 { | 1607 { |
| 1572 if (scrollbarsSuppressed()) | 1608 if (scrollbarsSuppressed()) |
| 1573 return false; | 1609 return false; |
| 1574 | 1610 |
| 1575 // If the main thread updates the scroll position for this FrameView, we sho uld return | 1611 // If the main thread updates the scroll position for this FrameView, we sho uld return |
| 1576 // ScrollAnimator::isRubberBandInProgress(). | 1612 // ScrollAnimator::isRubberBandInProgress(). |
| 1577 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 1613 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3000 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3036 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3001 { | 3037 { |
| 3002 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3038 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3003 if (AXObjectCache* cache = axObjectCache()) { | 3039 if (AXObjectCache* cache = axObjectCache()) { |
| 3004 cache->remove(scrollbar); | 3040 cache->remove(scrollbar); |
| 3005 cache->handleScrollbarUpdate(this); | 3041 cache->handleScrollbarUpdate(this); |
| 3006 } | 3042 } |
| 3007 } | 3043 } |
| 3008 | 3044 |
| 3009 } // namespace blink | 3045 } // namespace blink |
| OLD | NEW |