| 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using extensions::FeatureSwitch; | 25 using extensions::FeatureSwitch; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // Matches the clipping radius of |GradientButtonCell|. | 29 // Matches the clipping radius of |GradientButtonCell|. |
| 30 const CGFloat kCornerRadius = 3.0; | 30 const CGFloat kCornerRadius = 3.0; |
| 31 | 31 |
| 32 // How far to inset the left- and right-hand decorations from the field's | 32 // How far to inset the left- and right-hand decorations from the field's |
| 33 // bounds. | 33 // bounds. |
| 34 const CGFloat kRightDecorationXOffset = 5.0; | 34 const CGFloat kRightDecorationXOffset = 5.0; |
| 35 CGFloat LeftDecorationXOffset() { | 35 const CGFloat kLeftDecorationXOffset = 6.0; |
| 36 const CGFloat kLeftDecorationXOffset = 5.0; | |
| 37 const CGFloat kLeftMaterialDecorationXOffset = 6.0; | |
| 38 return ui::MaterialDesignController::IsModeMaterial() | |
| 39 ? kLeftMaterialDecorationXOffset | |
| 40 : kLeftDecorationXOffset; | |
| 41 } | |
| 42 | 36 |
| 43 // The amount of padding on either side reserved for drawing | 37 // The amount of padding on either side reserved for drawing |
| 44 // decorations. [Views has |kItemPadding| == 3.] | 38 // decorations. [Views has |kItemPadding| == 3.] |
| 45 CGFloat DecorationsHorizontalPad() { | 39 const CGFloat kDecorationHorizontalPad = 4.0; |
| 46 const CGFloat kDecorationHorizontalPad = 3.0; | |
| 47 const CGFloat kMaterialDecorationHorizontalPad = 4.0; | |
| 48 return ui::MaterialDesignController::IsModeMaterial() | |
| 49 ? kMaterialDecorationHorizontalPad | |
| 50 : kDecorationHorizontalPad; | |
| 51 } | |
| 52 | |
| 53 const ui::NinePartImageIds kPopupBorderImageIds = | |
| 54 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); | |
| 55 | |
| 56 const ui::NinePartImageIds kNormalBorderImageIds = IMAGE_GRID(IDR_TEXTFIELD); | |
| 57 | 40 |
| 58 // How long to wait for mouse-up on the location icon before assuming | 41 // How long to wait for mouse-up on the location icon before assuming |
| 59 // that the user wants to drag. | 42 // that the user wants to drag. |
| 60 const NSTimeInterval kLocationIconDragTimeout = 0.25; | 43 const NSTimeInterval kLocationIconDragTimeout = 0.25; |
| 61 | 44 |
| 62 // Calculate the positions for a set of decorations. |frame| is the | 45 // Calculate the positions for a set of decorations. |frame| is the |
| 63 // overall frame to do layout in, |remaining_frame| will get the | 46 // overall frame to do layout in, |remaining_frame| will get the |
| 64 // left-over space. |all_decorations| is the set of decorations to | 47 // left-over space. |all_decorations| is the set of decorations to |
| 65 // lay out, |decorations| will be set to the decorations which are | 48 // lay out, |decorations| will be set to the decorations which are |
| 66 // visible and which fit, in the same order as |all_decorations|, | 49 // visible and which fit, in the same order as |all_decorations|, |
| 67 // while |decoration_frames| will be the corresponding frames. | 50 // while |decoration_frames| will be the corresponding frames. |
| 68 // |x_edge| describes the edge to layout the decorations against | 51 // |x_edge| describes the edge to layout the decorations against |
| 69 // (|NSMinXEdge| or |NSMaxXEdge|). |regular_padding| is the padding | 52 // (|NSMinXEdge| or |NSMaxXEdge|). |regular_padding| is the padding |
| 70 // from the edge of |cell_frame| to use when the first visible decoration | 53 // from the edge of |cell_frame| to use when the first visible decoration |
| 71 // is a regular decoration. | 54 // is a regular decoration. |
| 72 void CalculatePositionsHelper( | 55 void CalculatePositionsHelper( |
| 73 NSRect frame, | 56 NSRect frame, |
| 74 const std::vector<LocationBarDecoration*>& all_decorations, | 57 const std::vector<LocationBarDecoration*>& all_decorations, |
| 75 NSRectEdge x_edge, | 58 NSRectEdge x_edge, |
| 76 CGFloat regular_padding, | 59 CGFloat regular_padding, |
| 77 std::vector<LocationBarDecoration*>* decorations, | 60 std::vector<LocationBarDecoration*>* decorations, |
| 78 std::vector<NSRect>* decoration_frames, | 61 std::vector<NSRect>* decoration_frames, |
| 79 NSRect* remaining_frame) { | 62 NSRect* remaining_frame) { |
| 80 DCHECK(x_edge == NSMinXEdge || x_edge == NSMaxXEdge); | 63 DCHECK(x_edge == NSMinXEdge || x_edge == NSMaxXEdge); |
| 81 DCHECK_EQ(decorations->size(), decoration_frames->size()); | 64 DCHECK_EQ(decorations->size(), decoration_frames->size()); |
| 82 | 65 |
| 83 // The initial padding depends on whether the first visible decoration is | 66 // The initial padding depends on whether the first visible decoration is |
| 84 // a button or not. | 67 // a button or not. |
| 85 bool is_first_visible_decoration = true; | 68 bool is_first_visible_decoration = true; |
| 86 const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad(); | |
| 87 | 69 |
| 88 for (size_t i = 0; i < all_decorations.size(); ++i) { | 70 for (size_t i = 0; i < all_decorations.size(); ++i) { |
| 89 if (all_decorations[i]->IsVisible()) { | 71 if (all_decorations[i]->IsVisible()) { |
| 90 CGFloat padding = kDecorationHorizontalPad; | 72 CGFloat padding = kDecorationHorizontalPad; |
| 91 if (is_first_visible_decoration) { | 73 if (is_first_visible_decoration) { |
| 92 padding = regular_padding; | 74 padding = regular_padding; |
| 93 is_first_visible_decoration = false; | 75 is_first_visible_decoration = false; |
| 94 } | 76 } |
| 95 | 77 |
| 96 NSRect padding_rect, available; | 78 NSRect padding_rect, available; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 const std::vector<LocationBarDecoration*>& left_decorations, | 122 const std::vector<LocationBarDecoration*>& left_decorations, |
| 141 const std::vector<LocationBarDecoration*>& right_decorations, | 123 const std::vector<LocationBarDecoration*>& right_decorations, |
| 142 std::vector<LocationBarDecoration*>* decorations, | 124 std::vector<LocationBarDecoration*>* decorations, |
| 143 std::vector<NSRect>* decoration_frames, | 125 std::vector<NSRect>* decoration_frames, |
| 144 NSRect* remaining_frame) { | 126 NSRect* remaining_frame) { |
| 145 decorations->clear(); | 127 decorations->clear(); |
| 146 decoration_frames->clear(); | 128 decoration_frames->clear(); |
| 147 | 129 |
| 148 // Layout |left_decorations| against the LHS. | 130 // Layout |left_decorations| against the LHS. |
| 149 CalculatePositionsHelper(frame, left_decorations, NSMinXEdge, | 131 CalculatePositionsHelper(frame, left_decorations, NSMinXEdge, |
| 150 LeftDecorationXOffset(), decorations, | 132 kLeftDecorationXOffset, decorations, |
| 151 decoration_frames, &frame); | 133 decoration_frames, &frame); |
| 152 DCHECK_EQ(decorations->size(), decoration_frames->size()); | 134 DCHECK_EQ(decorations->size(), decoration_frames->size()); |
| 153 | 135 |
| 154 // Capture the number of visible left-hand decorations. | 136 // Capture the number of visible left-hand decorations. |
| 155 const size_t left_count = decorations->size(); | 137 const size_t left_count = decorations->size(); |
| 156 | 138 |
| 157 // Layout |right_decorations| against the RHS. | 139 // Layout |right_decorations| against the RHS. |
| 158 CalculatePositionsHelper(frame, right_decorations, NSMaxXEdge, | 140 CalculatePositionsHelper(frame, right_decorations, NSMaxXEdge, |
| 159 kRightDecorationXOffset, decorations, | 141 kRightDecorationXOffset, decorations, |
| 160 decoration_frames, &frame); | 142 decoration_frames, &frame); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 NSRect textFrame = [super textFrameForFrame:cellFrame]; | 238 NSRect textFrame = [super textFrameForFrame:cellFrame]; |
| 257 CalculatePositionsInFrame(textFrame, leftDecorations_, rightDecorations_, | 239 CalculatePositionsInFrame(textFrame, leftDecorations_, rightDecorations_, |
| 258 &decorations, &decorationFrames, &textFrame); | 240 &decorations, &decorationFrames, &textFrame); |
| 259 | 241 |
| 260 // The text needs to be slightly higher than its default position to match the | 242 // The text needs to be slightly higher than its default position to match the |
| 261 // Material Design spec. It turns out this adjustment is equal to the single | 243 // Material Design spec. It turns out this adjustment is equal to the single |
| 262 // pixel line width (so 1 on non-Retina, 0.5 on Retina). Make this adjustment | 244 // pixel line width (so 1 on non-Retina, 0.5 on Retina). Make this adjustment |
| 263 // after computing decoration positions because the decorations are already | 245 // after computing decoration positions because the decorations are already |
| 264 // correctly positioned. The spec also calls for positioning the text 1pt to | 246 // correctly positioned. The spec also calls for positioning the text 1pt to |
| 265 // the right of its default position. | 247 // the right of its default position. |
| 266 if (ui::MaterialDesignController::IsModeMaterial()) { | 248 textFrame.origin.x += 1; |
| 267 textFrame.origin.x += 1; | 249 textFrame.size.width -= 1; |
| 268 textFrame.size.width -= 1; | 250 textFrame.origin.y -= singlePixelLineWidth_; |
| 269 textFrame.origin.y -= singlePixelLineWidth_; | |
| 270 } | |
| 271 | 251 |
| 272 // NOTE: This function must closely match the logic in | 252 // NOTE: This function must closely match the logic in |
| 273 // |-drawInteriorWithFrame:inView:|. | 253 // |-drawInteriorWithFrame:inView:|. |
| 274 | 254 |
| 275 return textFrame; | 255 return textFrame; |
| 276 } | 256 } |
| 277 | 257 |
| 278 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { | 258 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { |
| 279 std::vector<LocationBarDecoration*> decorations; | 259 std::vector<LocationBarDecoration*> decorations; |
| 280 std::vector<NSRect> decorationFrames; | 260 std::vector<NSRect> decorationFrames; |
| 281 NSRect textFrame; | 261 NSRect textFrame; |
| 282 size_t left_count = | 262 size_t left_count = |
| 283 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, | 263 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, |
| 284 &decorations, &decorationFrames, &textFrame); | 264 &decorations, &decorationFrames, &textFrame); |
| 285 | 265 |
| 286 // Determine the left-most extent for the i-beam cursor. | 266 // Determine the left-most extent for the i-beam cursor. |
| 287 CGFloat minX = NSMinX(textFrame); | 267 CGFloat minX = NSMinX(textFrame); |
| 288 const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad(); | |
| 289 for (size_t index = left_count; index--; ) { | 268 for (size_t index = left_count; index--; ) { |
| 290 if (decorations[index]->AcceptsMousePress()) | 269 if (decorations[index]->AcceptsMousePress()) |
| 291 break; | 270 break; |
| 292 | 271 |
| 293 // If at leftmost decoration, expand to edge of cell. | 272 // If at leftmost decoration, expand to edge of cell. |
| 294 if (!index) { | 273 if (!index) { |
| 295 minX = NSMinX(cellFrame); | 274 minX = NSMinX(cellFrame); |
| 296 } else { | 275 } else { |
| 297 minX = NSMinX(decorationFrames[index]) - kDecorationHorizontalPad; | 276 minX = NSMinX(decorationFrames[index]) - kDecorationHorizontalPad; |
| 298 } | 277 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 310 } else { | 289 } else { |
| 311 maxX = NSMaxX(decorationFrames[index]) + kDecorationHorizontalPad; | 290 maxX = NSMaxX(decorationFrames[index]) + kDecorationHorizontalPad; |
| 312 } | 291 } |
| 313 } | 292 } |
| 314 | 293 |
| 315 // I-beam cursor covers left-most to right-most. | 294 // I-beam cursor covers left-most to right-most. |
| 316 return NSMakeRect(minX, NSMinY(textFrame), maxX - minX, NSHeight(textFrame)); | 295 return NSMakeRect(minX, NSMinY(textFrame), maxX - minX, NSHeight(textFrame)); |
| 317 } | 296 } |
| 318 | 297 |
| 319 - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { | 298 - (void)drawWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| 320 BOOL isModeMaterial = ui::MaterialDesignController::IsModeMaterial(); | |
| 321 BOOL inDarkMode = [[controlView window] inIncognitoModeWithSystemTheme]; | 299 BOOL inDarkMode = [[controlView window] inIncognitoModeWithSystemTheme]; |
| 322 BOOL showingFirstResponder = [self showsFirstResponder]; | 300 BOOL showingFirstResponder = [self showsFirstResponder]; |
| 323 // Adjust the inset by 1/2 the line width to get a crisp line (screen pixels | 301 // Adjust the inset by 1/2 the line width to get a crisp line (screen pixels |
| 324 // lay between cooridnate space lines). | 302 // lay between cooridnate space lines). |
| 325 CGFloat insetSize = 1 - singlePixelLineWidth_ / 2.; | 303 CGFloat insetSize = 1 - singlePixelLineWidth_ / 2.; |
| 326 if (isModeMaterial && showingFirstResponder && !inDarkMode) { | 304 if (showingFirstResponder && !inDarkMode) { |
| 327 insetSize++; | 305 insetSize++; |
| 328 } else if (!isModeMaterial) { | |
| 329 insetSize = singlePixelLineWidth_ == 0.5 ? 1.5 : 2.0; | |
| 330 } | 306 } |
| 331 | 307 |
| 332 // Compute the border's bezier path. | 308 // Compute the border's bezier path. |
| 333 NSRect pathRect = NSInsetRect(frame, insetSize, insetSize); | 309 NSRect pathRect = NSInsetRect(frame, insetSize, insetSize); |
| 334 NSBezierPath* path = | 310 NSBezierPath* path = |
| 335 [NSBezierPath bezierPathWithRoundedRect:pathRect | 311 [NSBezierPath bezierPathWithRoundedRect:pathRect |
| 336 xRadius:kCornerRadius | 312 xRadius:kCornerRadius |
| 337 yRadius:kCornerRadius]; | 313 yRadius:kCornerRadius]; |
| 338 if (isModeMaterial) { | 314 [path setLineWidth:showingFirstResponder ? singlePixelLineWidth_ * 2 |
| 339 [path setLineWidth:showingFirstResponder ? singlePixelLineWidth_ * 2 | 315 : singlePixelLineWidth_]; |
| 340 : singlePixelLineWidth_]; | |
| 341 } | |
| 342 | 316 |
| 343 // Fill the background. | 317 // Fill the background. |
| 344 [[self backgroundColor] set]; | 318 [[self backgroundColor] set]; |
| 345 if (isPopupMode_) { | 319 if (isPopupMode_) { |
| 346 NSRectFillUsingOperation(NSInsetRect(frame, 1, 1), NSCompositeSourceOver); | 320 NSRectFillUsingOperation(NSInsetRect(frame, 1, 1), NSCompositeSourceOver); |
| 347 } else { | 321 } else { |
| 348 [path fill]; | 322 [path fill]; |
| 349 } | 323 } |
| 350 | 324 |
| 351 // Draw the border. | 325 // Draw the border. |
| 352 if (isModeMaterial) { | 326 if (!inDarkMode) { |
| 353 if (!inDarkMode) { | 327 const CGFloat kNormalStrokeGray = 168 / 255.; |
| 354 const CGFloat kNormalStrokeGray = 168 / 255.; | 328 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; |
| 355 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; | |
| 356 } else { | |
| 357 const CGFloat k30PercentAlpha = 0.3; | |
| 358 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; | |
| 359 } | |
| 360 [path stroke]; | |
| 361 } else { | 329 } else { |
| 362 ui::DrawNinePartImage(frame, | 330 const CGFloat k30PercentAlpha = 0.3; |
| 363 isPopupMode_ ? kPopupBorderImageIds | 331 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; |
| 364 : kNormalBorderImageIds, | |
| 365 NSCompositeSourceOver, | |
| 366 1.0, | |
| 367 true); | |
| 368 } | 332 } |
| 333 [path stroke]; |
| 369 | 334 |
| 370 // Draw the interior contents. We do this after drawing the border as some | 335 // Draw the interior contents. We do this after drawing the border as some |
| 371 // of the interior controls draw over it. | 336 // of the interior controls draw over it. |
| 372 [self drawInteriorWithFrame:frame inView:controlView]; | 337 [self drawInteriorWithFrame:frame inView:controlView]; |
| 373 | 338 |
| 374 // Draw the focus ring. | 339 // Draw the focus ring. |
| 375 if (showingFirstResponder) { | 340 if (showingFirstResponder) { |
| 376 if (!isModeMaterial) { | |
| 377 NSRect focusRingRect = | |
| 378 NSInsetRect(frame, singlePixelLineWidth_, singlePixelLineWidth_); | |
| 379 path = [NSBezierPath bezierPathWithRoundedRect:focusRingRect | |
| 380 xRadius:kCornerRadius | |
| 381 yRadius:kCornerRadius]; | |
| 382 [path setLineWidth:singlePixelLineWidth_ * 2.0]; | |
| 383 } | |
| 384 | |
| 385 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; | 341 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; |
| 386 if (isModeMaterial && inDarkMode) { | 342 if (inDarkMode) { |
| 387 // Special focus color for Material Incognito. | 343 // Special focus color for Material Incognito. |
| 388 [[NSColor colorWithSRGBRed:123 / 255. | 344 [[NSColor colorWithSRGBRed:123 / 255. |
| 389 green:170 / 255. | 345 green:170 / 255. |
| 390 blue:247 / 255. | 346 blue:247 / 255. |
| 391 alpha:1] set]; | 347 alpha:1] set]; |
| 392 } else { | 348 } else { |
| 393 [[[NSColor keyboardFocusIndicatorColor] | 349 [[[NSColor keyboardFocusIndicatorColor] |
| 394 colorWithAlphaComponent:alphaComponent] set]; | 350 colorWithAlphaComponent:alphaComponent] set]; |
| 395 } | 351 } |
| 396 [path stroke]; | 352 [path stroke]; |
| 397 } | 353 } |
| 398 } | 354 } |
| 399 | 355 |
| 400 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 356 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| 401 std::vector<LocationBarDecoration*> decorations; | 357 std::vector<LocationBarDecoration*> decorations; |
| 402 std::vector<NSRect> decorationFrames; | 358 std::vector<NSRect> decorationFrames; |
| 403 NSRect workingFrame; | 359 NSRect workingFrame; |
| 404 | 360 |
| 405 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, | 361 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, |
| 406 &decorations, &decorationFrames, &workingFrame); | 362 &decorations, &decorationFrames, &workingFrame); |
| 407 | 363 |
| 408 // Draw the decorations. | 364 // Draw the decorations. |
| 409 const CGFloat kDecorationHorizontalPad = DecorationsHorizontalPad(); | |
| 410 for (size_t i = 0; i < decorations.size(); ++i) { | 365 for (size_t i = 0; i < decorations.size(); ++i) { |
| 411 if (decorations[i]) { | 366 if (decorations[i]) { |
| 412 NSRect background_frame = NSInsetRect( | 367 NSRect background_frame = NSInsetRect( |
| 413 decorationFrames[i], -(kDecorationHorizontalPad + 1) / 2, 2); | 368 decorationFrames[i], -(kDecorationHorizontalPad + 1) / 2, 2); |
| 414 decorations[i]->DrawWithBackgroundInFrame( | 369 decorations[i]->DrawWithBackgroundInFrame( |
| 415 background_frame, decorationFrames[i], controlView); | 370 background_frame, decorationFrames[i], controlView); |
| 416 } | 371 } |
| 417 } | 372 } |
| 418 | 373 |
| 419 // NOTE: This function must closely match the logic in | 374 // NOTE: This function must closely match the logic in |
| 420 // |-textFrameForFrame:|. | 375 // |-textFrameForFrame:|. |
| 421 | 376 |
| 422 // Superclass draws text portion WRT original |cellFrame|. | 377 // Superclass draws text portion WRT original |cellFrame|. |
| 423 ui::ScopedCGContextSmoothFonts fontSmoothing; | 378 ui::ScopedCGContextSmoothFonts fontSmoothing; |
| 424 [super drawInteriorWithFrame:cellFrame inView:controlView]; | 379 [super drawInteriorWithFrame:cellFrame inView:controlView]; |
| 425 } | 380 } |
| 426 | 381 |
| 427 - (BOOL)canDropAtLocationInWindow:(NSPoint)location | 382 - (BOOL)canDropAtLocationInWindow:(NSPoint)location |
| 428 ofView:(AutocompleteTextField*)controlView { | 383 ofView:(AutocompleteTextField*)controlView { |
| 429 NSRect cellFrame = [controlView bounds]; | 384 NSRect cellFrame = [controlView bounds]; |
| 430 const NSPoint locationInView = | 385 const NSPoint locationInView = |
| 431 [controlView convertPoint:location fromView:nil]; | 386 [controlView convertPoint:location fromView:nil]; |
| 432 | 387 |
| 433 // If we have decorations, the drop can't occur at their horizontal padding. | 388 // If we have decorations, the drop can't occur at their horizontal padding. |
| 434 if (!leftDecorations_.empty() && locationInView.x < LeftDecorationXOffset()) | 389 if (!leftDecorations_.empty() && locationInView.x < kLeftDecorationXOffset) |
| 435 return false; | 390 return false; |
| 436 | 391 |
| 437 if (!rightDecorations_.empty() && | 392 if (!rightDecorations_.empty() && |
| 438 locationInView.x > NSWidth(cellFrame) - kRightDecorationXOffset) { | 393 locationInView.x > NSWidth(cellFrame) - kRightDecorationXOffset) { |
| 439 return false; | 394 return false; |
| 440 } | 395 } |
| 441 | 396 |
| 442 LocationBarDecoration* decoration = | 397 LocationBarDecoration* decoration = |
| 443 [self decorationForLocationInWindow:location | 398 [self decorationForLocationInWindow:location |
| 444 inRect:cellFrame | 399 inRect:cellFrame |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 731 |
| 777 - (void)handleFocusEvent:(NSEvent*)event | 732 - (void)handleFocusEvent:(NSEvent*)event |
| 778 ofView:(AutocompleteTextField*)controlView { | 733 ofView:(AutocompleteTextField*)controlView { |
| 779 if ([controlView observer]) { | 734 if ([controlView observer]) { |
| 780 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; | 735 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; |
| 781 [controlView observer]->OnSetFocus(controlDown); | 736 [controlView observer]->OnSetFocus(controlDown); |
| 782 } | 737 } |
| 783 } | 738 } |
| 784 | 739 |
| 785 @end | 740 @end |
| OLD | NEW |