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

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

Issue 2747463003: Ensure clean layout for a call site of FrameSelection::contains() (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/WebKit/LayoutTests/hittesting/subframe_active_crash.html ('k') | no next file » | 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * Copyright (C) 2015 Google Inc. All rights reserved. 6 * Copyright (C) 2015 Google Inc. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 return selectClosestMisspellingFromMouseEvent(mev); 1008 return selectClosestMisspellingFromMouseEvent(mev);
1009 1009
1010 if (!m_frame->editor().behavior().shouldSelectOnContextualMenuClick()) 1010 if (!m_frame->editor().behavior().shouldSelectOnContextualMenuClick())
1011 return; 1011 return;
1012 1012
1013 selectClosestWordOrLinkFromMouseEvent(mev); 1013 selectClosestWordOrLinkFromMouseEvent(mev);
1014 } 1014 }
1015 1015
1016 void SelectionController::passMousePressEventToSubframe( 1016 void SelectionController::passMousePressEventToSubframe(
1017 const MouseEventWithHitTestResults& mev) { 1017 const MouseEventWithHitTestResults& mev) {
1018 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1019 // needs to be audited. See http://crbug.com/590369 for more details.
1020 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1021
1018 // If we're clicking into a frame that is selected, the frame will appear 1022 // If we're clicking into a frame that is selected, the frame will appear
1019 // greyed out even though we're clicking on the selection. This looks 1023 // greyed out even though we're clicking on the selection. This looks
1020 // really strange (having the whole frame be greyed out), so we deselect the 1024 // really strange (having the whole frame be greyed out), so we deselect the
1021 // selection. 1025 // selection.
1022 IntPoint p = m_frame->view()->rootFrameToContents( 1026 IntPoint p = m_frame->view()->rootFrameToContents(
1023 flooredIntPoint(mev.event().positionInRootFrame())); 1027 flooredIntPoint(mev.event().positionInRootFrame()));
1024 if (!selection().contains(p)) 1028 if (!selection().contains(p))
1025 return; 1029 return;
1026 1030
1027 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1028 // needs to be audited. See http://crbug.com/590369 for more details.
1029 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1030
1031 const VisiblePositionInFlatTree& visiblePos = 1031 const VisiblePositionInFlatTree& visiblePos =
1032 visiblePositionOfHitTestResult(mev.hitTestResult()); 1032 visiblePositionOfHitTestResult(mev.hitTestResult());
1033 if (visiblePos.isNull()) { 1033 if (visiblePos.isNull()) {
1034 selection().setSelection(SelectionInFlatTree()); 1034 selection().setSelection(SelectionInFlatTree());
1035 return; 1035 return;
1036 } 1036 }
1037 selection().setSelection(SelectionInFlatTree::Builder() 1037 selection().setSelection(SelectionInFlatTree::Builder()
1038 .collapse(visiblePos.toPositionWithAffinity()) 1038 .collapse(visiblePos.toPositionWithAffinity())
1039 .build()); 1039 .build());
1040 } 1040 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { 1089 bool isExtendingSelection(const MouseEventWithHitTestResults& event) {
1090 bool isMouseDownOnLinkOrImage = 1090 bool isMouseDownOnLinkOrImage =
1091 event.isOverLink() || event.hitTestResult().image(); 1091 event.isOverLink() || event.hitTestResult().image();
1092 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != 1092 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) !=
1093 0 && 1093 0 &&
1094 !isMouseDownOnLinkOrImage; 1094 !isMouseDownOnLinkOrImage;
1095 } 1095 }
1096 1096
1097 } // namespace blink 1097 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/hittesting/subframe_active_crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698