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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 1122593004: firstRectForCharacterRange(): don't fall over in an editable-less frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « LayoutTests/editing/input/text-input-controller-no-editable-no-crash-expected.txt ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 { 1071 {
1072 return frame()->inputMethodController().compositionRange(); 1072 return frame()->inputMethodController().compositionRange();
1073 } 1073 }
1074 1074
1075 bool WebLocalFrameImpl::firstRectForCharacterRange(unsigned location, unsigned l ength, WebRect& rectInViewport) const 1075 bool WebLocalFrameImpl::firstRectForCharacterRange(unsigned location, unsigned l ength, WebRect& rectInViewport) const
1076 { 1076 {
1077 if ((location + length < location) && (location + length)) 1077 if ((location + length < location) && (location + length))
1078 length = 0; 1078 length = 0;
1079 1079
1080 Element* editable = frame()->selection().rootEditableElementOrDocumentElemen t(); 1080 Element* editable = frame()->selection().rootEditableElementOrDocumentElemen t();
1081 ASSERT(editable); 1081 if (!editable)
1082 return false;
1082 RefPtrWillBeRawPtr<Range> range = PlainTextRange(location, location + length ).createRange(*editable); 1083 RefPtrWillBeRawPtr<Range> range = PlainTextRange(location, location + length ).createRange(*editable);
1083 if (!range) 1084 if (!range)
1084 return false; 1085 return false;
1085 IntRect intRect = frame()->editor().firstRectForRange(range.get()); 1086 IntRect intRect = frame()->editor().firstRectForRange(range.get());
1086 rectInViewport = WebRect(intRect); 1087 rectInViewport = WebRect(intRect);
1087 rectInViewport = frame()->view()->contentsToViewport(rectInViewport); 1088 rectInViewport = frame()->view()->contentsToViewport(rectInViewport);
1088 return true; 1089 return true;
1089 } 1090 }
1090 1091
1091 size_t WebLocalFrameImpl::characterIndexForPoint(const WebPoint& pointInViewport ) const 1092 size_t WebLocalFrameImpl::characterIndexForPoint(const WebPoint& pointInViewport ) const
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 { 2091 {
2091 m_frameWidget = frameWidget; 2092 m_frameWidget = frameWidget;
2092 } 2093 }
2093 2094
2094 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2095 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2095 { 2096 {
2096 return m_frameWidget; 2097 return m_frameWidget;
2097 } 2098 }
2098 2099
2099 } // namespace blink 2100 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/editing/input/text-input-controller-no-editable-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698