Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 454643002: Route selection bounds updates through WebLayerTreeView (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix bug in tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 16 matching lines...) Expand all
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/MediaTypeNames.h" 31 #include "core/MediaTypeNames.h"
32 #include "core/accessibility/AXObjectCache.h" 32 #include "core/accessibility/AXObjectCache.h"
33 #include "core/css/FontFaceSet.h" 33 #include "core/css/FontFaceSet.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/DocumentMarkerController.h" 35 #include "core/dom/DocumentMarkerController.h"
36 #include "core/editing/FrameSelection.h" 36 #include "core/editing/FrameSelection.h"
37 #include "core/editing/RenderedPosition.h"
37 #include "core/events/OverflowEvent.h" 38 #include "core/events/OverflowEvent.h"
38 #include "core/fetch/ResourceFetcher.h" 39 #include "core/fetch/ResourceFetcher.h"
39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" 40 #include "core/fetch/ResourceLoadPriorityOptimizer.h"
40 #include "core/frame/FrameHost.h" 41 #include "core/frame/FrameHost.h"
41 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
42 #include "core/frame/Settings.h" 43 #include "core/frame/Settings.h"
43 #include "core/html/HTMLFrameElement.h" 44 #include "core/html/HTMLFrameElement.h"
44 #include "core/html/HTMLPlugInElement.h" 45 #include "core/html/HTMLPlugInElement.h"
45 #include "core/html/parser/TextResourceDecoder.h" 46 #include "core/html/parser/TextResourceDecoder.h"
46 #include "core/inspector/InspectorInstrumentation.h" 47 #include "core/inspector/InspectorInstrumentation.h"
(...skipping 12 matching lines...) Expand all
59 #include "core/rendering/RenderLayer.h" 60 #include "core/rendering/RenderLayer.h"
60 #include "core/rendering/RenderListBox.h" 61 #include "core/rendering/RenderListBox.h"
61 #include "core/rendering/RenderPart.h" 62 #include "core/rendering/RenderPart.h"
62 #include "core/rendering/RenderScrollbar.h" 63 #include "core/rendering/RenderScrollbar.h"
63 #include "core/rendering/RenderScrollbarPart.h" 64 #include "core/rendering/RenderScrollbarPart.h"
64 #include "core/rendering/RenderTheme.h" 65 #include "core/rendering/RenderTheme.h"
65 #include "core/rendering/RenderView.h" 66 #include "core/rendering/RenderView.h"
66 #include "core/rendering/RenderWidget.h" 67 #include "core/rendering/RenderWidget.h"
67 #include "core/rendering/TextAutosizer.h" 68 #include "core/rendering/TextAutosizer.h"
68 #include "core/rendering/compositing/CompositedLayerMapping.h" 69 #include "core/rendering/compositing/CompositedLayerMapping.h"
70 #include "core/rendering/compositing/CompositedSelectionBound.h"
69 #include "core/rendering/compositing/RenderLayerCompositor.h" 71 #include "core/rendering/compositing/RenderLayerCompositor.h"
70 #include "core/rendering/style/RenderStyle.h" 72 #include "core/rendering/style/RenderStyle.h"
71 #include "core/rendering/svg/RenderSVGRoot.h" 73 #include "core/rendering/svg/RenderSVGRoot.h"
72 #include "core/svg/SVGDocumentExtensions.h" 74 #include "core/svg/SVGDocumentExtensions.h"
73 #include "core/svg/SVGSVGElement.h" 75 #include "core/svg/SVGSVGElement.h"
74 #include "platform/RuntimeEnabledFeatures.h" 76 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/ScriptForbiddenScope.h" 77 #include "platform/ScriptForbiddenScope.h"
76 #include "platform/TraceEvent.h" 78 #include "platform/TraceEvent.h"
77 #include "platform/fonts/FontCache.h" 79 #include "platform/fonts/FontCache.h"
78 #include "platform/geometry/FloatRect.h" 80 #include "platform/geometry/FloatRect.h"
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 // If there fixed position elements, scrolling may cause compositing layers to change. 1502 // If there fixed position elements, scrolling may cause compositing layers to change.
1501 // Update widget and layer positions after scrolling, but only if we're not inside of 1503 // Update widget and layer positions after scrolling, but only if we're not inside of
1502 // layout. 1504 // layout.
1503 if (!m_nestedLayoutCount) { 1505 if (!m_nestedLayoutCount) {
1504 updateWidgetPositions(); 1506 updateWidgetPositions();
1505 if (RenderView* renderView = this->renderView()) 1507 if (RenderView* renderView = this->renderView())
1506 renderView->layer()->setNeedsCompositingInputsUpdate(); 1508 renderView->layer()->setNeedsCompositingInputsUpdate();
1507 } 1509 }
1508 } 1510 }
1509 1511
1512 bool FrameView::computeCompositedSelectionBounds(LocalFrame& frame, CompositedSe lectionBound& start, CompositedSelectionBound& end)
1513 {
1514 const VisibleSelection &selection = frame.selection().selection();
1515 if (!selection.isCaretOrRange())
1516 return false;
1517
1518 VisiblePosition visibleStart(selection.visibleStart());
1519 VisiblePosition visibleEnd(selection.visibleEnd());
1520
1521 RenderedPosition renderedStart(visibleStart);
1522 RenderedPosition renderedEnd(visibleEnd);
1523 FloatPoint edgeTop, edgeBottom;
1524
1525 renderedStart.layerPoints(start.layer, start.edgeTopInLayer, start.edgeBotto mInLayer);
1526 renderedEnd.layerPoints(end.layer, end.edgeTopInLayer, end.edgeBottomInLayer );
1527
1528 if (selection.isCaret()) {
1529 start.type = end.type = CompositedSelectionBound::Caret;
1530 return true;
1531 }
1532
1533 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection();
1534 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection();
1535 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co mpositedSelectionBound::SelectionLeft;
1536 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi tedSelectionBound::SelectionRight;
1537 return true;
1538 }
1539
1510 void FrameView::updateCompositedSelectionBoundsIfNeeded() 1540 void FrameView::updateCompositedSelectionBoundsIfNeeded()
1511 { 1541 {
1512 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 1542 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
1513 return; 1543 return;
1514 1544
1515 Page* page = frame().page(); 1545 Page* page = frame().page();
1516 ASSERT(page); 1546 ASSERT(page);
1517 1547
1548 CompositedSelectionBound start, end;
1518 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( )); 1549 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame( ));
1519 if (!frame || !frame->selection().isCaretOrRange()) { 1550 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) {
1520 page->chrome().client().clearCompositedSelectionBounds(); 1551 page->chrome().client().clearCompositedSelectionBounds();
1521 return; 1552 return;
1522 } 1553 }
1523 1554
1524 // TODO(jdduke): Compute and route selection bounds through ChromeClient. 1555 page->chrome().client().updateCompositedSelectionBounds(start, end);
1525 } 1556 }
1526 1557
1527 bool FrameView::isRubberBandInProgress() const 1558 bool FrameView::isRubberBandInProgress() const
1528 { 1559 {
1529 if (scrollbarsSuppressed()) 1560 if (scrollbarsSuppressed())
1530 return false; 1561 return false;
1531 1562
1532 // If the main thread updates the scroll position for this FrameView, we sho uld return 1563 // If the main thread updates the scroll position for this FrameView, we sho uld return
1533 // ScrollAnimator::isRubberBandInProgress(). 1564 // ScrollAnimator::isRubberBandInProgress().
1534 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 1565 if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2964 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 2995 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
2965 { 2996 {
2966 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 2997 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
2967 if (AXObjectCache* cache = axObjectCache()) { 2998 if (AXObjectCache* cache = axObjectCache()) {
2968 cache->remove(scrollbar); 2999 cache->remove(scrollbar);
2969 cache->handleScrollbarUpdate(this); 3000 cache->handleScrollbarUpdate(this);
2970 } 3001 }
2971 } 3002 }
2972 3003
2973 } // namespace blink 3004 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698