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

Side by Side Diff: sky/engine/core/editing/FrameSelection.cpp

Issue 681553003: Remove a bunch of unused or never-set settings. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/editing/EditorCommand.cpp ('k') | sky/engine/core/frame/Settings.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return; 1229 return;
1230 m_caretRectDirty = false; 1230 m_caretRectDirty = false;
1231 1231
1232 RenderObject* renderer = nullptr; 1232 RenderObject* renderer = nullptr;
1233 LayoutRect newRect = localCaretRect(m_selection, PositionWithAffinity(m_sele ction.start(), m_selection.affinity()), renderer); 1233 LayoutRect newRect = localCaretRect(m_selection, PositionWithAffinity(m_sele ction.start(), m_selection.affinity()), renderer);
1234 Node* newNode = renderer ? renderer->node() : nullptr; 1234 Node* newNode = renderer ? renderer->node() : nullptr;
1235 1235
1236 if (!m_caretBlinkTimer.isActive() && newNode == m_previousCaretNode && newRe ct == m_previousCaretRect) 1236 if (!m_caretBlinkTimer.isActive() && newNode == m_previousCaretNode && newRe ct == m_previousCaretRect)
1237 return; 1237 return;
1238 1238
1239 RenderView* view = m_frame->document()->renderView(); 1239 if (m_previousCaretNode && m_previousCaretNode->isContentEditable())
1240 if (m_previousCaretNode && shouldRepaintCaret(view, m_previousCaretNode->isC ontentEditable()))
1241 invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect) ; 1240 invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect) ;
1242 if (newNode && shouldRepaintCaret(view, newNode->isContentEditable())) 1241 if (newNode && newNode->isContentEditable())
1243 invalidateLocalCaretRect(newNode, newRect); 1242 invalidateLocalCaretRect(newNode, newRect);
1244 1243
1245 m_previousCaretNode = newNode; 1244 m_previousCaretNode = newNode;
1246 m_previousCaretRect = newRect; 1245 m_previousCaretRect = newRect;
1247 } 1246 }
1248 1247
1249 void FrameSelection::paintCaret(GraphicsContext* context, const LayoutPoint& pai ntOffset, const LayoutRect& clipRect) 1248 void FrameSelection::paintCaret(GraphicsContext* context, const LayoutPoint& pai ntOffset, const LayoutRect& clipRect)
1250 { 1249 {
1251 if (m_selection.isCaret() && m_shouldPaintCaret) { 1250 if (m_selection.isCaret() && m_shouldPaintCaret) {
1252 updateCaretRect(m_frame->document(), PositionWithAffinity(m_selection.st art(), m_selection.affinity())); 1251 updateCaretRect(m_frame->document(), PositionWithAffinity(m_selection.st art(), m_selection.affinity()));
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 CaretBase::setCaretVisibility(visibility); 1504 CaretBase::setCaretVisibility(visibility);
1506 1505
1507 updateAppearance(); 1506 updateAppearance();
1508 } 1507 }
1509 1508
1510 bool FrameSelection::shouldBlinkCaret() const 1509 bool FrameSelection::shouldBlinkCaret() const
1511 { 1510 {
1512 if (!caretIsVisible() || !isCaret()) 1511 if (!caretIsVisible() || !isCaret())
1513 return false; 1512 return false;
1514 1513
1515 if (m_frame->settings() && m_frame->settings()->caretBrowsingEnabled())
1516 return false;
1517
1518 Element* root = rootEditableElement(); 1514 Element* root = rootEditableElement();
1519 if (!root) 1515 if (!root)
1520 return false; 1516 return false;
1521 1517
1522 Element* focusedElement = root->document().focusedElement(); 1518 Element* focusedElement = root->document().focusedElement();
1523 if (!focusedElement) 1519 if (!focusedElement)
1524 return false; 1520 return false;
1525 1521
1526 return focusedElement->containsIncludingShadowDOM(m_selection.start().anchor Node()); 1522 return focusedElement->containsIncludingShadowDOM(m_selection.start().anchor Node());
1527 } 1523 }
(...skipping 23 matching lines...) Expand all
1551 return false; 1547 return false;
1552 Widget* widget = toRenderWidget(renderer)->widget(); 1548 Widget* widget = toRenderWidget(renderer)->widget();
1553 return widget && widget->isFrameView(); 1549 return widget && widget->isFrameView();
1554 } 1550 }
1555 1551
1556 void FrameSelection::setFocusedNodeIfNeeded() 1552 void FrameSelection::setFocusedNodeIfNeeded()
1557 { 1553 {
1558 if (isNone() || !isFocused()) 1554 if (isNone() || !isFocused())
1559 return; 1555 return;
1560 1556
1561 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsi ngEnabled();
1562 if (caretBrowsing) {
1563 if (Element* anchor = enclosingAnchorElement(base())) {
1564 m_frame->page()->focusController().setFocusedElement(anchor, m_frame );
1565 return;
1566 }
1567 }
1568
1569 if (Element* target = rootEditableElement()) { 1557 if (Element* target = rootEditableElement()) {
1570 // Walk up the DOM tree to search for a node to focus. 1558 // Walk up the DOM tree to search for a node to focus.
1571 while (target) { 1559 while (target) {
1572 // We don't want to set focus on a subframe when selecting in a pare nt frame, 1560 // We don't want to set focus on a subframe when selecting in a pare nt frame,
1573 // so add the !isFrameElement check here. There's probably a better way to make this 1561 // so add the !isFrameElement check here. There's probably a better way to make this
1574 // work in the long term, but this is the safest fix at this time. 1562 // work in the long term, but this is the safest fix at this time.
1575 if (target->isMouseFocusable() && !isFrameElement(target)) { 1563 if (target->isMouseFocusable() && !isFrameElement(target)) {
1576 m_frame->page()->focusController().setFocusedElement(target, m_f rame); 1564 m_frame->page()->focusController().setFocusedElement(target, m_f rame);
1577 return; 1565 return;
1578 } 1566 }
1579 target = target->parentOrShadowHostElement(); 1567 target = target->parentOrShadowHostElement();
1580 } 1568 }
1581 m_frame->document()->setFocusedElement(nullptr); 1569 m_frame->document()->setFocusedElement(nullptr);
1582 } 1570 }
1583
1584 if (caretBrowsing)
1585 m_frame->page()->focusController().setFocusedElement(0, m_frame);
1586 } 1571 }
1587 1572
1588 static String extractSelectedText(const FrameSelection& selection, TextIteratorB ehavior behavior) 1573 static String extractSelectedText(const FrameSelection& selection, TextIteratorB ehavior behavior)
1589 { 1574 {
1590 // We remove '\0' characters because they are not visibly rendered to the us er. 1575 // We remove '\0' characters because they are not visibly rendered to the us er.
1591 return plainText(selection.toNormalizedRange().get(), behavior).replace(0, " "); 1576 return plainText(selection.toNormalizedRange().get(), behavior).replace(0, " ");
1592 } 1577 }
1593 1578
1594 String FrameSelection::selectedText() const 1579 String FrameSelection::selectedText() const
1595 { 1580 {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 sel.showTreeForThis(); 1748 sel.showTreeForThis();
1764 } 1749 }
1765 1750
1766 void showTree(const blink::FrameSelection* sel) 1751 void showTree(const blink::FrameSelection* sel)
1767 { 1752 {
1768 if (sel) 1753 if (sel)
1769 sel->showTreeForThis(); 1754 sel->showTreeForThis();
1770 } 1755 }
1771 1756
1772 #endif 1757 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/editing/EditorCommand.cpp ('k') | sky/engine/core/frame/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698