OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 DCHECK(line_break_point); | 1303 DCHECK(line_break_point); |
1304 if (range.start() >= bounds.size() || range.is_reversed() || range.is_empty()) | 1304 if (range.start() >= bounds.size() || range.is_reversed() || range.is_empty()) |
1305 return false; | 1305 return false; |
1306 | 1306 |
1307 // We can't check line breaking completely from only rectangle array. Thus we | 1307 // We can't check line breaking completely from only rectangle array. Thus we |
1308 // assume the line breaking as the next character's y offset is larger than | 1308 // assume the line breaking as the next character's y offset is larger than |
1309 // a threshold. Currently the threshold is determined as minimum y offset plus | 1309 // a threshold. Currently the threshold is determined as minimum y offset plus |
1310 // 75% of maximum height. | 1310 // 75% of maximum height. |
1311 // TODO(nona): Check the threshold is reliable or not. | 1311 // TODO(nona): Check the threshold is reliable or not. |
1312 // TODO(nona): Bidi support. | 1312 // TODO(nona): Bidi support. |
1313 const size_t loop_end_idx = std::min(bounds.size(), range.end()); | 1313 const size_t loop_end_idx = |
| 1314 std::min(bounds.size(), static_cast<size_t>(range.end())); |
1314 int max_height = 0; | 1315 int max_height = 0; |
1315 int min_y_offset = std::numeric_limits<int32_t>::max(); | 1316 int min_y_offset = std::numeric_limits<int32_t>::max(); |
1316 for (size_t idx = range.start(); idx < loop_end_idx; ++idx) { | 1317 for (size_t idx = range.start(); idx < loop_end_idx; ++idx) { |
1317 max_height = std::max(max_height, bounds[idx].height()); | 1318 max_height = std::max(max_height, bounds[idx].height()); |
1318 min_y_offset = std::min(min_y_offset, bounds[idx].y()); | 1319 min_y_offset = std::min(min_y_offset, bounds[idx].y()); |
1319 } | 1320 } |
1320 int line_break_threshold = min_y_offset + (max_height * 3 / 4); | 1321 int line_break_threshold = min_y_offset + (max_height * 3 / 4); |
1321 for (size_t idx = range.start(); idx < loop_end_idx; ++idx) { | 1322 for (size_t idx = range.start(); idx < loop_end_idx; ++idx) { |
1322 if (bounds[idx].y() > line_break_threshold) { | 1323 if (bounds[idx].y() > line_break_threshold) { |
1323 *line_break_point = idx; | 1324 *line_break_point = idx; |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 | 3445 |
3445 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3446 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3446 // regions that are not draggable. (See ControlRegionView in | 3447 // regions that are not draggable. (See ControlRegionView in |
3447 // native_app_window_cocoa.mm). This requires the render host view to be | 3448 // native_app_window_cocoa.mm). This requires the render host view to be |
3448 // draggable by default. | 3449 // draggable by default. |
3449 - (BOOL)mouseDownCanMoveWindow { | 3450 - (BOOL)mouseDownCanMoveWindow { |
3450 return YES; | 3451 return YES; |
3451 } | 3452 } |
3452 | 3453 |
3453 @end | 3454 @end |
OLD | NEW |