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

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

Issue 834693007: Remove the remaining parts of ignorePendingStylesheets and placeholder styles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove comment. Created 5 years, 11 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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 } 1193 }
1194 1194
1195 static bool isNonOrphanedCaret(const VisibleSelection& selection) 1195 static bool isNonOrphanedCaret(const VisibleSelection& selection)
1196 { 1196 {
1197 return selection.isCaret() && !selection.start().isOrphan() && !selection.en d().isOrphan(); 1197 return selection.isCaret() && !selection.start().isOrphan() && !selection.en d().isOrphan();
1198 } 1198 }
1199 1199
1200 IntRect FrameSelection::absoluteCaretBounds() 1200 IntRect FrameSelection::absoluteCaretBounds()
1201 { 1201 {
1202 ASSERT(m_frame->document()->lifecycle().state() != DocumentLifecycle::InPain tInvalidation); 1202 ASSERT(m_frame->document()->lifecycle().state() != DocumentLifecycle::InPain tInvalidation);
1203 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1203 m_frame->document()->updateLayout();
1204 if (!isNonOrphanedCaret(m_selection)) { 1204 if (!isNonOrphanedCaret(m_selection)) {
1205 clearCaretRect(); 1205 clearCaretRect();
1206 } else { 1206 } else {
1207 updateCaretRect(m_frame->document(), VisiblePosition(m_selection.start() , m_selection.affinity())); 1207 updateCaretRect(m_frame->document(), VisiblePosition(m_selection.start() , m_selection.affinity()));
1208 } 1208 }
1209 return absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), loca lCaretRectWithoutUpdate()); 1209 return absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), loca lCaretRectWithoutUpdate());
1210 } 1210 }
1211 1211
1212 static LayoutRect localCaretRect(const VisibleSelection& m_selection, const Posi tionWithAffinity& caretPosition, RenderObject*& renderer) 1212 static LayoutRect localCaretRect(const VisibleSelection& m_selection, const Posi tionWithAffinity& caretPosition, RenderObject*& renderer)
1213 { 1213 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1459
1460 VisibleSelection selection; 1460 VisibleSelection selection;
1461 VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForwa rd(CharacterGranularity) : m_selection.visibleEnd(); 1461 VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForwa rd(CharacterGranularity) : m_selection.visibleEnd();
1462 selection = VisibleSelection(m_selection.visibleStart(), endVisiblePosition) ; 1462 selection = VisibleSelection(m_selection.visibleStart(), endVisiblePosition) ;
1463 1463
1464 if (!selection.isRange()) { 1464 if (!selection.isRange()) {
1465 view->clearSelection(); 1465 view->clearSelection();
1466 return; 1466 return;
1467 } 1467 }
1468 1468
1469 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1469 m_frame->document()->updateLayout();
1470 1470
1471 // Use the rightmost candidate for the start of the selection, and the leftm ost candidate for the end of the selection. 1471 // Use the rightmost candidate for the start of the selection, and the leftm ost candidate for the end of the selection.
1472 // Example: foo <a>bar</a>. Imagine that a line wrap occurs after 'foo', an d that 'bar' is selected. If we pass [foo, 3] 1472 // Example: foo <a>bar</a>. Imagine that a line wrap occurs after 'foo', an d that 'bar' is selected. If we pass [foo, 3]
1473 // as the start of the selection, the selection painting code will think tha t content on the line containing 'foo' is selected 1473 // as the start of the selection, the selection painting code will think tha t content on the line containing 'foo' is selected
1474 // and will fill the gap before 'bar'. 1474 // and will fill the gap before 'bar'.
1475 Position startPos = selection.start(); 1475 Position startPos = selection.start();
1476 Position candidate = startPos.downstream(); 1476 Position candidate = startPos.downstream();
1477 if (candidate.isCandidate()) 1477 if (candidate.isCandidate())
1478 startPos = candidate; 1478 startPos = candidate;
1479 Position endPos = selection.end(); 1479 Position endPos = selection.end();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 if (!selectStartTarget) 1620 if (!selectStartTarget)
1621 return true; 1621 return true;
1622 1622
1623 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart)); 1623 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart));
1624 } 1624 }
1625 1625
1626 void FrameSelection::setShouldShowBlockCursor(bool shouldShowBlockCursor) 1626 void FrameSelection::setShouldShowBlockCursor(bool shouldShowBlockCursor)
1627 { 1627 {
1628 m_shouldShowBlockCursor = shouldShowBlockCursor; 1628 m_shouldShowBlockCursor = shouldShowBlockCursor;
1629 1629
1630 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 1630 m_frame->document()->updateLayout();
1631 1631
1632 updateAppearance(); 1632 updateAppearance();
1633 } 1633 }
1634 1634
1635 void FrameSelection::didChangeVisibleSelection() 1635 void FrameSelection::didChangeVisibleSelection()
1636 { 1636 {
1637 ASSERT(m_observingVisibleSelection); 1637 ASSERT(m_observingVisibleSelection);
1638 // Invalidate the logical range when the underlying VisibleSelection has cha nged. 1638 // Invalidate the logical range when the underlying VisibleSelection has cha nged.
1639 m_logicalRange = nullptr; 1639 m_logicalRange = nullptr;
1640 m_selection.clearChangeObserver(); 1640 m_selection.clearChangeObserver();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 sel.showTreeForThis(); 1716 sel.showTreeForThis();
1717 } 1717 }
1718 1718
1719 void showTree(const blink::FrameSelection* sel) 1719 void showTree(const blink::FrameSelection* sel)
1720 { 1720 {
1721 if (sel) 1721 if (sel)
1722 sel->showTreeForThis(); 1722 sel->showTreeForThis();
1723 } 1723 }
1724 1724
1725 #endif 1725 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/editing/EditorCommand.cpp ('k') | sky/engine/core/editing/InsertLineBreakCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698