| 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 16 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| 1524 renderedStart.positionInGraphicsLayerBacking(start); |
| 1525 renderedEnd.positionInGraphicsLayerBacking(end); |
| 1526 |
| 1527 if (selection.isCaret()) { |
| 1528 start.type = end.type = CompositedSelectionBound::Caret; |
| 1529 return true; |
| 1530 } |
| 1531 |
| 1532 TextDirection startDir = visibleStart.deepEquivalent().primaryDirection(); |
| 1533 TextDirection endDir = visibleEnd.deepEquivalent().primaryDirection(); |
| 1534 start.type = startDir == RTL ? CompositedSelectionBound::SelectionRight : Co
mpositedSelectionBound::SelectionLeft; |
| 1535 end.type = endDir == RTL ? CompositedSelectionBound::SelectionLeft : Composi
tedSelectionBound::SelectionRight; |
| 1536 return true; |
| 1537 } |
| 1538 |
| 1510 void FrameView::updateCompositedSelectionBoundsIfNeeded() | 1539 void FrameView::updateCompositedSelectionBoundsIfNeeded() |
| 1511 { | 1540 { |
| 1512 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) | 1541 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) |
| 1513 return; | 1542 return; |
| 1514 | 1543 |
| 1515 Page* page = frame().page(); | 1544 Page* page = frame().page(); |
| 1516 ASSERT(page); | 1545 ASSERT(page); |
| 1517 | 1546 |
| 1547 CompositedSelectionBound start, end; |
| 1518 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); | 1548 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); |
| 1519 if (!frame || !frame->selection().isCaretOrRange()) { | 1549 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { |
| 1520 page->chrome().client().clearCompositedSelectionBounds(); | 1550 page->chrome().client().clearCompositedSelectionBounds(); |
| 1521 return; | 1551 return; |
| 1522 } | 1552 } |
| 1523 | 1553 |
| 1524 // TODO(jdduke): Compute and route selection bounds through ChromeClient. | 1554 page->chrome().client().updateCompositedSelectionBounds(start, end); |
| 1525 } | 1555 } |
| 1526 | 1556 |
| 1527 bool FrameView::isRubberBandInProgress() const | 1557 bool FrameView::isRubberBandInProgress() const |
| 1528 { | 1558 { |
| 1529 if (scrollbarsSuppressed()) | 1559 if (scrollbarsSuppressed()) |
| 1530 return false; | 1560 return false; |
| 1531 | 1561 |
| 1532 // If the main thread updates the scroll position for this FrameView, we sho
uld return | 1562 // If the main thread updates the scroll position for this FrameView, we sho
uld return |
| 1533 // ScrollAnimator::isRubberBandInProgress(). | 1563 // ScrollAnimator::isRubberBandInProgress(). |
| 1534 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 1564 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
| (...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2972 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3002 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
| 2973 { | 3003 { |
| 2974 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3004 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 2975 if (AXObjectCache* cache = axObjectCache()) { | 3005 if (AXObjectCache* cache = axObjectCache()) { |
| 2976 cache->remove(scrollbar); | 3006 cache->remove(scrollbar); |
| 2977 cache->handleScrollbarUpdate(this); | 3007 cache->handleScrollbarUpdate(this); |
| 2978 } | 3008 } |
| 2979 } | 3009 } |
| 2980 | 3010 |
| 2981 } // namespace blink | 3011 } // namespace blink |
| OLD | NEW |