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

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionModifier.cpp

Issue 2338233003: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in previous/nextLinePosition (Closed)
Patch Set: Rebased Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('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, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 { 525 {
526 if (selection->isBaseFirst()) { 526 if (selection->isBaseFirst()) {
527 selection->setBase(newStart); 527 selection->setBase(newStart);
528 return; 528 return;
529 } 529 }
530 selection->setExtent(newStart); 530 selection->setExtent(newStart);
531 } 531 }
532 532
533 bool SelectionModifier::modify(EAlteration alter, SelectionDirection direction, TextGranularity granularity) 533 bool SelectionModifier::modify(EAlteration alter, SelectionDirection direction, TextGranularity granularity)
534 { 534 {
535 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
536 // needs to be audited. See http://crbug.com/590369 for more details.
537 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
538
539 DocumentLifecycle::DisallowTransitionScope disallowTransition(frame()->docum ent()->lifecycle());
540
535 willBeModified(alter, direction); 541 willBeModified(alter, direction);
536 542
537 bool wasRange = m_selection.isRange(); 543 bool wasRange = m_selection.isRange();
538 VisiblePosition originalStartPosition = m_selection.visibleStart(); 544 VisiblePosition originalStartPosition = m_selection.visibleStart();
539 VisiblePosition position; 545 VisiblePosition position;
540 switch (direction) { 546 switch (direction) {
541 case DirectionRight: 547 case DirectionRight:
542 if (alter == FrameSelection::AlterationMove) 548 if (alter == FrameSelection::AlterationMove)
543 position = modifyMovingRight(granularity); 549 position = modifyMovingRight(granularity);
544 else 550 else
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return false; 635 return false;
630 y = rect.y() + rect.height() / 2; 636 y = rect.y() + rect.height() / 2;
631 return true; 637 return true;
632 } 638 }
633 639
634 bool SelectionModifier::modifyWithPageGranularity(EAlteration alter, unsigned ve rticalDistance, VerticalDirection direction) 640 bool SelectionModifier::modifyWithPageGranularity(EAlteration alter, unsigned ve rticalDistance, VerticalDirection direction)
635 { 641 {
636 if (!verticalDistance) 642 if (!verticalDistance)
637 return false; 643 return false;
638 644
645 DCHECK(!frame()->document()->needsLayoutTreeUpdate());
646 DocumentLifecycle::DisallowTransitionScope disallowTransition(frame()->docum ent()->lifecycle());
647
639 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa ckward : DirectionForward); 648 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa ckward : DirectionForward);
640 649
641 VisiblePosition pos; 650 VisiblePosition pos;
642 LayoutUnit xPos; 651 LayoutUnit xPos;
643 switch (alter) { 652 switch (alter) {
644 case FrameSelection::AlterationMove: 653 case FrameSelection::AlterationMove:
645 pos = createVisiblePosition(direction == FrameSelection::DirectionUp ? m _selection.start() : m_selection.end(), m_selection.affinity()); 654 pos = createVisiblePosition(direction == FrameSelection::DirectionUp ? m _selection.start() : m_selection.end(), m_selection.affinity());
646 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS election::DirectionUp ? START : END); 655 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS election::DirectionUp ? START : END);
647 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA ffinity::Upstream : TextAffinity::Downstream); 656 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA ffinity::Upstream : TextAffinity::Downstream);
648 break; 657 break;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return x; 771 return x;
763 } 772 }
764 773
765 DEFINE_TRACE(SelectionModifier) 774 DEFINE_TRACE(SelectionModifier)
766 { 775 {
767 visitor->trace(m_frame); 776 visitor->trace(m_frame);
768 visitor->trace(m_selection); 777 visitor->trace(m_selection);
769 } 778 }
770 779
771 } // namespace blink 780 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698