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

Side by Side Diff: third_party/WebKit/Source/web/mac/WebSubstringUtil.mm

Issue 2730573003: Moved FrameHost::m_visualViewport to Page (Closed)
Patch Set: Fixed some compile errors on mac and android 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 23 matching lines...) Expand all
34 #import <Cocoa/Cocoa.h> 34 #import <Cocoa/Cocoa.h>
35 35
36 #include "bindings/core/v8/ExceptionState.h" 36 #include "bindings/core/v8/ExceptionState.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/Element.h" 38 #include "core/dom/Element.h"
39 #include "core/dom/Node.h" 39 #include "core/dom/Node.h"
40 #include "core/dom/Range.h" 40 #include "core/dom/Range.h"
41 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
42 #include "core/editing/PlainTextRange.h" 42 #include "core/editing/PlainTextRange.h"
43 #include "core/editing/iterators/TextIterator.h" 43 #include "core/editing/iterators/TextIterator.h"
44 #include "core/frame/FrameHost.h"
45 #include "core/frame/FrameView.h" 44 #include "core/frame/FrameView.h"
46 #include "core/frame/LocalFrame.h" 45 #include "core/frame/LocalFrame.h"
47 #include "core/frame/VisualViewport.h" 46 #include "core/frame/VisualViewport.h"
48 #include "core/html/HTMLElement.h" 47 #include "core/html/HTMLElement.h"
49 #include "core/layout/HitTestResult.h" 48 #include "core/layout/HitTestResult.h"
50 #include "core/layout/LayoutObject.h" 49 #include "core/layout/LayoutObject.h"
50 #include "core/page/PAge.h"
51 #include "core/style/ComputedStyle.h" 51 #include "core/style/ComputedStyle.h"
52 #include "platform/fonts/Font.h" 52 #include "platform/fonts/Font.h"
53 #include "platform/mac/ColorMac.h" 53 #include "platform/mac/ColorMac.h"
54 #include "public/platform/WebRect.h" 54 #include "public/platform/WebRect.h"
55 #include "public/web/WebFrameWidget.h" 55 #include "public/web/WebFrameWidget.h"
56 #include "public/web/WebHitTestResult.h" 56 #include "public/web/WebHitTestResult.h"
57 #include "public/web/WebLocalFrame.h" 57 #include "public/web/WebLocalFrame.h"
58 #include "public/web/WebRange.h" 58 #include "public/web/WebRange.h"
59 #include "web/WebFrameWidgetBase.h" 59 #include "web/WebFrameWidgetBase.h"
60 #include "web/WebLocalFrameImpl.h" 60 #include "web/WebLocalFrameImpl.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Expand to word under point. 172 // Expand to word under point.
173 const VisibleSelection& selection = 173 const VisibleSelection& selection =
174 createVisibleSelection(SelectionInDOMTree::Builder() 174 createVisibleSelection(SelectionInDOMTree::Builder()
175 .setBaseAndExtent(range) 175 .setBaseAndExtent(range)
176 .setGranularity(WordGranularity) 176 .setGranularity(WordGranularity)
177 .build()); 177 .build());
178 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange(); 178 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange();
179 179
180 // Convert to NSAttributedString. 180 // Convert to NSAttributedString.
181 NSAttributedString* string = attributedSubstringFromRange( 181 NSAttributedString* string = attributedSubstringFromRange(
182 wordRange, frame->host()->visualViewport().scale()); 182 wordRange, frame->page()->visualViewport().scale());
183 baselinePoint = getBaselinePoint(frame->view(), wordRange, string); 183 baselinePoint = getBaselinePoint(frame->view(), wordRange, string);
184 return string; 184 return string;
185 } 185 }
186 186
187 NSAttributedString* WebSubstringUtil::attributedSubstringInRange( 187 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(
188 WebLocalFrame* webFrame, 188 WebLocalFrame* webFrame,
189 size_t location, 189 size_t location,
190 size_t length) { 190 size_t length) {
191 return WebSubstringUtil::attributedSubstringInRange(webFrame, location, 191 return WebSubstringUtil::attributedSubstringInRange(webFrame, location,
192 length, nil); 192 length, nil);
(...skipping 10 matching lines...) Expand all
203 203
204 Element* editable = frame->selection().rootEditableElementOrDocumentElement(); 204 Element* editable = frame->selection().rootEditableElementOrDocumentElement();
205 if (!editable) 205 if (!editable)
206 return nil; 206 return nil;
207 const EphemeralRange ephemeralRange( 207 const EphemeralRange ephemeralRange(
208 PlainTextRange(location, location + length).createRange(*editable)); 208 PlainTextRange(location, location + length).createRange(*editable));
209 if (ephemeralRange.isNull()) 209 if (ephemeralRange.isNull())
210 return nil; 210 return nil;
211 211
212 NSAttributedString* result = attributedSubstringFromRange( 212 NSAttributedString* result = attributedSubstringFromRange(
213 ephemeralRange, frame->host()->visualViewport().scale()); 213 ephemeralRange, frame->page()->visualViewport().scale());
214 if (baselinePoint) 214 if (baselinePoint)
215 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result); 215 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result);
216 return result; 216 return result;
217 } 217 }
218 218
219 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698