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

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 431983005: FrameSelection::updateApperance for caret should not cause layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 { 89 {
90 return !frame || frame->editor().behavior().shouldConsiderSelectionAsDirecti onal(); 90 return !frame || frame->editor().behavior().shouldConsiderSelectionAsDirecti onal();
91 } 91 }
92 92
93 FrameSelection::FrameSelection(LocalFrame* frame) 93 FrameSelection::FrameSelection(LocalFrame* frame)
94 : m_frame(frame) 94 : m_frame(frame)
95 , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation()) 95 , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation())
96 , m_observingVisibleSelection(false) 96 , m_observingVisibleSelection(false)
97 , m_granularity(CharacterGranularity) 97 , m_granularity(CharacterGranularity)
98 , m_caretBlinkTimer(this, &FrameSelection::caretBlinkTimerFired) 98 , m_caretBlinkTimer(this, &FrameSelection::caretBlinkTimerFired)
99 , m_absCaretBoundsDirty(true) 99 , m_caretRectDirty(true)
100 , m_caretPaint(true) 100 , m_caretPaint(true)
101 , m_isCaretBlinkingSuspended(false) 101 , m_isCaretBlinkingSuspended(false)
102 , m_focused(frame && frame->page() && frame->page()->focusController().focus edFrame() == frame) 102 , m_focused(frame && frame->page() && frame->page()->focusController().focus edFrame() == frame)
103 , m_shouldShowBlockCursor(false) 103 , m_shouldShowBlockCursor(false)
104 { 104 {
105 if (shouldAlwaysUseDirectionalSelection(m_frame)) 105 if (shouldAlwaysUseDirectionalSelection(m_frame))
106 m_selection.setIsDirectional(true); 106 m_selection.setIsDirectional(true);
107 } 107 }
108 108
109 FrameSelection::~FrameSelection() 109 FrameSelection::~FrameSelection()
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 VisibleSelection oldSelection = m_selection; 266 VisibleSelection oldSelection = m_selection;
267 267
268 m_selection = s; 268 m_selection = s;
269 setCaretRectNeedsUpdate(); 269 setCaretRectNeedsUpdate();
270 270
271 if (!s.isNone() && !(options & DoNotSetFocus)) 271 if (!s.isNone() && !(options & DoNotSetFocus))
272 setFocusedNodeIfNeeded(); 272 setFocusedNodeIfNeeded();
273 273
274 if (!(options & DoNotUpdateAppearance)) { 274 if (!(options & DoNotUpdateAppearance)) {
275 m_frame->document()->updateLayoutIgnorePendingStylesheets();
276
277 // Hits in compositing/overflow/do-not-paint-outline-into-composited-scr olling-contents.html 275 // Hits in compositing/overflow/do-not-paint-outline-into-composited-scr olling-contents.html
278 DisableCompositingQueryAsserts disabler; 276 DisableCompositingQueryAsserts disabler;
279 updateAppearance(); 277 updateAppearance(ResetCaretBlink);
280 } 278 }
281 279
282 // Always clear the x position used for vertical arrow navigation. 280 // Always clear the x position used for vertical arrow navigation.
283 // It will be restored by the vertical arrow navigation code if necessary. 281 // It will be restored by the vertical arrow navigation code if necessary.
284 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); 282 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation();
285 selectFrameElementInParentIfFullySelected(); 283 selectFrameElementInParentIfFullySelected();
286 notifyRendererOfSelectionChange(userTriggered); 284 notifyRendererOfSelectionChange(userTriggered);
287 m_frame->editor().respondToChangedSelection(oldSelection, options); 285 m_frame->editor().respondToChangedSelection(oldSelection, options);
288 if (userTriggered == UserTriggered) { 286 if (userTriggered == UserTriggered) {
289 ScrollAlignment alignment; 287 ScrollAlignment alignment;
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 static bool isNonOrphanedCaret(const VisibleSelection& selection) 1221 static bool isNonOrphanedCaret(const VisibleSelection& selection)
1224 { 1222 {
1225 return selection.isCaret() && !selection.start().isOrphan() && !selection.en d().isOrphan(); 1223 return selection.isCaret() && !selection.start().isOrphan() && !selection.en d().isOrphan();
1226 } 1224 }
1227 1225
1228 static bool isTextFormControl(const VisibleSelection& selection) 1226 static bool isTextFormControl(const VisibleSelection& selection)
1229 { 1227 {
1230 return enclosingTextFormControl(selection.start()); 1228 return enclosingTextFormControl(selection.start());
1231 } 1229 }
1232 1230
1233 LayoutRect FrameSelection::localCaretRect()
1234 {
1235 if (shouldUpdateCaretRect()) {
1236 if (!isNonOrphanedCaret(m_selection))
1237 clearCaretRect();
1238 else if (isTextFormControl(m_selection))
1239 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Positi onWithAffinity(m_selection.start().isCandidate() ? m_selection.start() : Positio n(), m_selection.affinity()));
1240 else
1241 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Visibl ePosition(m_selection.start(), m_selection.affinity()));
1242 }
1243
1244 return localCaretRectWithoutUpdate();
1245 }
1246
1247 IntRect FrameSelection::absoluteCaretBounds() 1231 IntRect FrameSelection::absoluteCaretBounds()
1248 { 1232 {
1249 recomputeCaretRect(); 1233 if (!isNonOrphanedCaret(m_selection)) {
1250 return m_absCaretBounds; 1234 clearCaretRect();
1235 } else {
1236 m_frame->document()->updateLayoutIgnorePendingStylesheets();
abarth-chromium 2014/08/13 22:01:24 Is this call needed? When do we query in the abso
yoichio 2014/08/13 22:36:33 No. Removed.
1237 if (isTextFormControl(m_selection))
1238 updateCaretRect(m_frame->document(), PositionWithAffinity(m_selectio n.start().isCandidate() ? m_selection.start() : Position(), m_selection.affinity ()));
1239 else
1240 updateCaretRect(m_frame->document(), VisiblePosition(m_selection.sta rt(), m_selection.affinity()));
1241 }
1242 return absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), loca lCaretRectWithoutUpdate());
1251 } 1243 }
1252 1244
1253 bool FrameSelection::recomputeCaretRect() 1245 static LayoutRect localCaretRect(const VisibleSelection& m_selection, const Posi tionWithAffinity& caretPosition, RenderObject*& renderer)
1254 { 1246 {
1255 if (!shouldUpdateCaretRect()) 1247 renderer = nullptr;
1256 return false; 1248 if (!isNonOrphanedCaret(m_selection))
1249 return LayoutRect();
1257 1250
1258 if (!m_frame || !m_frame->document()->view()) 1251 return localCaretRectOfPosition(caretPosition, renderer);
1259 return false; 1252 }
1260 1253
1261 LayoutRect oldRect = localCaretRectWithoutUpdate(); 1254 static void invalidateLocalCaretRect(RenderObject* renderer, const LayoutRect& c aretRect)
1262 LayoutRect newRect = localCaretRect(); 1255 {
1263 if (oldRect == newRect && !m_absCaretBoundsDirty) 1256 // FIXME: Need to over-paint 1 pixel to workaround some rounding problems.
1264 return false; 1257 // https://bugs.webkit.org/show_bug.cgi?id=108283
1265 1258 LayoutRect inflatedRect = caretRect;
1266 IntRect oldAbsCaretBounds = m_absCaretBounds; 1259 inflatedRect.inflate(1);
1267 m_absCaretBounds = absoluteBoundsForLocalRect(m_selection.start().deprecated Node(), localCaretRectWithoutUpdate()); 1260 renderer->invalidatePaintRectangle(inflatedRect);
1268 m_absCaretBoundsDirty = false;
1269
1270 if (oldAbsCaretBounds == m_absCaretBounds)
1271 return false;
1272
1273 if (RenderView* view = m_frame->document()->renderView()) {
1274 if (m_previousCaretNode && shouldRepaintCaret(view, m_previousCaretNode- >isContentEditable()))
1275 repaintCaretForLocalRect(m_previousCaretNode.get(), oldRect);
1276 Node* node = m_selection.start().deprecatedNode();
1277 m_previousCaretNode = node;
1278 if (shouldRepaintCaret(view, isContentEditable()))
1279 repaintCaretForLocalRect(node, newRect);
1280 }
1281
1282 return true;
1283 } 1261 }
1284 1262
1285 void FrameSelection::invalidateCaretRect() 1263 void FrameSelection::invalidateCaretRect()
1286 { 1264 {
1287 if (!isCaret()) 1265 if (!m_caretRectDirty)
1266 return;
1267 m_caretRectDirty = false;
1268
1269 RenderObject* renderer = nullptr;
1270 LayoutRect newRect = localCaretRect(m_selection, PositionWithAffinity(m_sele ction.start(), m_selection.affinity()), renderer);
1271 Node* newNode = renderer ? renderer->node() : nullptr;
1272
1273 if (!m_caretBlinkTimer.isActive() && newNode == m_previousCaretNode && newRe ct == m_previousCaretRect)
1288 return; 1274 return;
1289 1275
1290 CaretBase::invalidateCaretRect(m_selection.start().deprecatedNode(), recompu teCaretRect()); 1276 RenderView* view = m_frame->document()->renderView();
1277 if (m_previousCaretNode && shouldRepaintCaret(view, m_previousCaretNode->isC ontentEditable()))
1278 invalidateLocalCaretRect(m_previousCaretNode->renderer(), m_previousCare tRect);
1279 if (newNode && shouldRepaintCaret(view, newNode->isContentEditable()))
1280 invalidateLocalCaretRect(newNode->renderer(), newRect);
1281
1282 m_previousCaretNode = newNode;
1283 m_previousCaretRect = newRect;
1291 } 1284 }
1292 1285
1293 void FrameSelection::paintCaret(GraphicsContext* context, const LayoutPoint& pai ntOffset, const LayoutRect& clipRect) 1286 void FrameSelection::paintCaret(GraphicsContext* context, const LayoutPoint& pai ntOffset, const LayoutRect& clipRect)
1294 { 1287 {
1295 if (m_selection.isCaret() && m_caretPaint) 1288 if (m_selection.isCaret() && m_caretPaint)
1296 CaretBase::paintCaret(m_selection.start().deprecatedNode(), context, pai ntOffset, clipRect); 1289 CaretBase::paintCaret(m_selection.start().deprecatedNode(), context, pai ntOffset, clipRect);
1297 } 1290 }
1298 1291
1299 bool FrameSelection::contains(const LayoutPoint& point) 1292 bool FrameSelection::contains(const LayoutPoint& point)
1300 { 1293 {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) 1451 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
1459 cache->selectionChanged(m_selection.start().containerNode()); 1452 cache->selectionChanged(m_selection.start().containerNode());
1460 } 1453 }
1461 } 1454 }
1462 1455
1463 void FrameSelection::notifyCompositorForSelectionChange() 1456 void FrameSelection::notifyCompositorForSelectionChange()
1464 { 1457 {
1465 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 1458 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
1466 return; 1459 return;
1467 1460
1468 if (Page* page = m_frame->page()) 1461 scheduleVisualUpdate();
1469 page->animator().scheduleVisualUpdate();
1470 } 1462 }
1471 1463
1472 void FrameSelection::focusedOrActiveStateChanged() 1464 void FrameSelection::focusedOrActiveStateChanged()
1473 { 1465 {
1474 bool activeAndFocused = isFocusedAndActive(); 1466 bool activeAndFocused = isFocusedAndActive();
1475 1467
1476 RefPtrWillBeRawPtr<Document> document = m_frame->document(); 1468 RefPtrWillBeRawPtr<Document> document = m_frame->document();
1477 document->updateRenderTreeIfNeeded(); 1469 document->updateRenderTreeIfNeeded();
1478 1470
1479 // Because RenderObject::selectionBackgroundColor() and 1471 // Because RenderObject::selectionBackgroundColor() and
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 bool FrameSelection::isFocusedAndActive() const 1525 bool FrameSelection::isFocusedAndActive() const
1534 { 1526 {
1535 return m_focused && m_frame->page() && m_frame->page()->focusController().is Active(); 1527 return m_focused && m_frame->page() && m_frame->page()->focusController().is Active();
1536 } 1528 }
1537 1529
1538 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) 1530 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame)
1539 { 1531 {
1540 return frame->editor().lastEditCommand() && frame->editor().lastEditCommand( )->shouldStopCaretBlinking(); 1532 return frame->editor().lastEditCommand() && frame->editor().lastEditCommand( )->shouldStopCaretBlinking();
1541 } 1533 }
1542 1534
1543 void FrameSelection::updateAppearance() 1535 void FrameSelection::updateAppearance(ResetCaretBlinkOption option)
1544 { 1536 {
1545 // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case 1537 // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case
1546 // the FrameSelection will paint a blinking caret as usual). 1538 // the FrameSelection will paint a blinking caret as usual).
1547 bool paintBlockCursor = m_shouldShowBlockCursor && m_selection.isCaret() && !isLogicalEndOfLine(m_selection.visibleEnd()); 1539 bool paintBlockCursor = m_shouldShowBlockCursor && m_selection.isCaret() && !isLogicalEndOfLine(m_selection.visibleEnd());
1548 1540
1549 bool caretRectChangedOrCleared = recomputeCaretRect();
1550 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); 1541 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret();
1551 1542
1543 bool isCaretRectNeedsUpdate = false;
abarth-chromium 2014/08/13 22:01:24 willNeedCaretRectUpdate
yoichio 2014/08/13 22:36:33 Done.
1544
1552 // If the caret moved, stop the blink timer so we can restart with a 1545 // If the caret moved, stop the blink timer so we can restart with a
1553 // black caret in the new location. 1546 // black caret in the new location.
1554 if (caretRectChangedOrCleared || !shouldBlink || shouldStopBlinkingDueToTypi ngCommand(m_frame)) { 1547 if (option == ResetCaretBlink || !shouldBlink || shouldStopBlinkingDueToTypi ngCommand(m_frame)) {
1555 m_caretBlinkTimer.stop(); 1548 m_caretBlinkTimer.stop();
1556 if (!shouldBlink && m_caretPaint) { 1549
1557 m_caretPaint = false; 1550 m_caretPaint = false;
1558 invalidateCaretRect(); 1551 isCaretRectNeedsUpdate = true;
1559 }
1560 } 1552 }
1561 1553
1562 // Start blinking with a black caret. Be sure not to restart if we're 1554 // Start blinking with a black caret. Be sure not to restart if we're
1563 // already blinking in the right location. 1555 // already blinking in the right location.
1564 if (shouldBlink && !m_caretBlinkTimer.isActive()) { 1556 if (shouldBlink && !m_caretBlinkTimer.isActive()) {
1565 if (double blinkInterval = RenderTheme::theme().caretBlinkInterval()) 1557 if (double blinkInterval = RenderTheme::theme().caretBlinkInterval())
1566 m_caretBlinkTimer.startRepeating(blinkInterval, FROM_HERE); 1558 m_caretBlinkTimer.startRepeating(blinkInterval, FROM_HERE);
1567 1559
1568 if (!m_caretPaint) { 1560 m_caretPaint = true;
1569 m_caretPaint = true; 1561 isCaretRectNeedsUpdate = true;
1570 invalidateCaretRect();
1571 }
1572 } 1562 }
1573 1563
1564 if (isCaretRectNeedsUpdate)
1565 setCaretRectNeedsUpdate();
1566
1574 RenderView* view = m_frame->contentRenderer(); 1567 RenderView* view = m_frame->contentRenderer();
1575 if (!view) 1568 if (!view)
1576 return; 1569 return;
1577 1570
1578 // Construct a new VisibleSolution, since m_selection is not necessarily val id, and the following steps 1571 // Construct a new VisibleSolution, since m_selection is not necessarily val id, and the following steps
1579 // assume a valid selection. See <https://bugs.webkit.org/show_bug.cgi?id=69 563> and <rdar://problem/10232866>. 1572 // assume a valid selection. See <https://bugs.webkit.org/show_bug.cgi?id=69 563> and <rdar://problem/10232866>.
1580 VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForwa rd(CharacterGranularity) : m_selection.visibleEnd(); 1573
1581 VisibleSelection selection(m_selection.visibleStart(), endVisiblePosition); 1574 VisibleSelection selection;
1575 if (isTextFormControl(m_selection)) {
1576 Position endPosition = paintBlockCursor ? m_selection.extent().next() : m_selection.end();
1577 selection.setWithoutValidation(m_selection.start(), endPosition);
1578 } else {
1579 VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingF orward(CharacterGranularity) : m_selection.visibleEnd();
1580 selection = VisibleSelection(m_selection.visibleStart(), endVisiblePosit ion);
1581 }
1582 1582
1583 if (!selection.isRange()) { 1583 if (!selection.isRange()) {
1584 view->clearSelection(); 1584 view->clearSelection();
1585 return; 1585 return;
1586 } 1586 }
1587 1587
1588 // Use the rightmost candidate for the start of the selection, and the leftm ost candidate for the end of the selection. 1588 // Use the rightmost candidate for the start of the selection, and the leftm ost candidate for the end of the selection.
1589 // Example: foo <a>bar</a>. Imagine that a line wrap occurs after 'foo', an d that 'bar' is selected. If we pass [foo, 3] 1589 // Example: foo <a>bar</a>. Imagine that a line wrap occurs after 'foo', an d that 'bar' is selected. If we pass [foo, 3]
1590 // as the start of the selection, the selection painting code will think tha t content on the line containing 'foo' is selected 1590 // as the start of the selection, the selection painting code will think tha t content on the line containing 'foo' is selected
1591 // and will fill the gap before 'bar'. 1591 // and will fill the gap before 'bar'.
(...skipping 14 matching lines...) Expand all
1606 if (startRenderer->view() == view && endRenderer->view() == view) 1606 if (startRenderer->view() == view && endRenderer->view() == view)
1607 view->setSelection(startRenderer, startPos.deprecatedEditingOffset() , endRenderer, endPos.deprecatedEditingOffset()); 1607 view->setSelection(startRenderer, startPos.deprecatedEditingOffset() , endRenderer, endPos.deprecatedEditingOffset());
1608 } 1608 }
1609 } 1609 }
1610 1610
1611 void FrameSelection::setCaretVisibility(CaretVisibility visibility) 1611 void FrameSelection::setCaretVisibility(CaretVisibility visibility)
1612 { 1612 {
1613 if (caretVisibility() == visibility) 1613 if (caretVisibility() == visibility)
1614 return; 1614 return;
1615 1615
1616 m_frame->document()->updateLayoutIgnorePendingStylesheets();
1617 if (m_caretPaint) {
1618 m_caretPaint = false;
1619 invalidateCaretRect();
1620 }
1621 CaretBase::setCaretVisibility(visibility); 1616 CaretBase::setCaretVisibility(visibility);
1622 1617
1623 updateAppearance(); 1618 updateAppearance();
1624 } 1619 }
1625 1620
1626 bool FrameSelection::shouldBlinkCaret() const 1621 bool FrameSelection::shouldBlinkCaret() const
1627 { 1622 {
1628 if (!caretIsVisible() || !isCaret()) 1623 if (!caretIsVisible() || !isCaret())
1629 return false; 1624 return false;
1630 1625
(...skipping 11 matching lines...) Expand all
1642 return focusedElement->containsIncludingShadowDOM(m_selection.start().anchor Node()); 1637 return focusedElement->containsIncludingShadowDOM(m_selection.start().anchor Node());
1643 } 1638 }
1644 1639
1645 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*) 1640 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*)
1646 { 1641 {
1647 ASSERT(caretIsVisible()); 1642 ASSERT(caretIsVisible());
1648 ASSERT(isCaret()); 1643 ASSERT(isCaret());
1649 if (isCaretBlinkingSuspended() && m_caretPaint) 1644 if (isCaretBlinkingSuspended() && m_caretPaint)
1650 return; 1645 return;
1651 m_caretPaint = !m_caretPaint; 1646 m_caretPaint = !m_caretPaint;
1652 invalidateCaretRect(); 1647 setCaretRectNeedsUpdate();
1653 } 1648 }
1654 1649
1655 void FrameSelection::notifyRendererOfSelectionChange(EUserTriggered userTriggere d) 1650 void FrameSelection::notifyRendererOfSelectionChange(EUserTriggered userTriggere d)
1656 { 1651 {
1657 m_frame->document()->updateRenderTreeIfNeeded();
1658
1659 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start ())) 1652 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start ()))
1660 textControl->selectionChanged(userTriggered == UserTriggered); 1653 textControl->selectionChanged(userTriggered == UserTriggered);
1661 } 1654 }
1662 1655
1663 // Helper function that tells whether a particular node is an element that has a n entire 1656 // Helper function that tells whether a particular node is an element that has a n entire
1664 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>. 1657 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>.
1665 static bool isFrameElement(const Node* n) 1658 static bool isFrameElement(const Node* n)
1666 { 1659 {
1667 if (!n) 1660 if (!n)
1668 return false; 1661 return false;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 void FrameSelection::trace(Visitor* visitor) 1901 void FrameSelection::trace(Visitor* visitor)
1909 { 1902 {
1910 visitor->trace(m_selection); 1903 visitor->trace(m_selection);
1911 visitor->trace(m_originalBase); 1904 visitor->trace(m_originalBase);
1912 visitor->trace(m_logicalRange); 1905 visitor->trace(m_logicalRange);
1913 visitor->trace(m_previousCaretNode); 1906 visitor->trace(m_previousCaretNode);
1914 visitor->trace(m_typingStyle); 1907 visitor->trace(m_typingStyle);
1915 VisibleSelection::ChangeObserver::trace(visitor); 1908 VisibleSelection::ChangeObserver::trace(visitor);
1916 } 1909 }
1917 1910
1911 void FrameSelection::setCaretRectNeedsUpdate()
1912 {
1913 m_caretRectDirty = true;
1914
1915 scheduleVisualUpdate();
1916 }
1917
1918 void FrameSelection::scheduleVisualUpdate() const
1919 {
1920 if (!m_frame)
1921 return;
1922 if (Page* page = m_frame->page())
1923 page->animator().scheduleVisualUpdate();
1924 }
1925
1918 } 1926 }
1919 1927
1920 #ifndef NDEBUG 1928 #ifndef NDEBUG
1921 1929
1922 void showTree(const blink::FrameSelection& sel) 1930 void showTree(const blink::FrameSelection& sel)
1923 { 1931 {
1924 sel.showTreeForThis(); 1932 sel.showTreeForThis();
1925 } 1933 }
1926 1934
1927 void showTree(const blink::FrameSelection* sel) 1935 void showTree(const blink::FrameSelection* sel)
1928 { 1936 {
1929 if (sel) 1937 if (sel)
1930 sel->showTreeForThis(); 1938 sel->showTreeForThis();
1931 } 1939 }
1932 1940
1933 #endif 1941 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698