gfx/skia/trunk/src/views/mac/SkTextFieldCell.m

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2011 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9 #import "SkTextFieldCell.h"
michael@0 10 @implementation SkTextFieldCell
michael@0 11 - (NSRect)drawingRectForBounds:(NSRect)theRect {
michael@0 12 NSRect newRect = [super drawingRectForBounds:theRect];
michael@0 13 if (selectingOrEditing == NO) {
michael@0 14 NSSize textSize = [self cellSizeForBounds:theRect];
michael@0 15 float heightDelta = newRect.size.height - textSize.height;
michael@0 16 if (heightDelta > 0) {
michael@0 17 newRect.size.height -= heightDelta;
michael@0 18 newRect.origin.y += (heightDelta / 2);
michael@0 19 }
michael@0 20 }
michael@0 21 return newRect;
michael@0 22 }
michael@0 23
michael@0 24 - (void)selectWithFrame:(NSRect)aRect
michael@0 25 inView:(NSView *)controlView
michael@0 26 editor:(NSText *)textObj
michael@0 27 delegate:(id)anObject
michael@0 28 start:(NSInteger)selStart
michael@0 29 length:(NSInteger)selLength {
michael@0 30 aRect = [self drawingRectForBounds:aRect];
michael@0 31 selectingOrEditing = YES;
michael@0 32 [super selectWithFrame:aRect
michael@0 33 inView:controlView
michael@0 34 editor:textObj
michael@0 35 delegate:anObject
michael@0 36 start:selStart
michael@0 37 length:selLength];
michael@0 38 selectingOrEditing = NO;
michael@0 39 }
michael@0 40
michael@0 41 - (void)editWithFrame:(NSRect)aRect
michael@0 42 inView:(NSView *)controlView
michael@0 43 editor:(NSText *)textObj
michael@0 44 delegate:(id)anObject
michael@0 45 event:(NSEvent *)theEvent {
michael@0 46 aRect = [self drawingRectForBounds:aRect];
michael@0 47 selectingOrEditing = YES;
michael@0 48 [super editWithFrame:aRect
michael@0 49 inView:controlView
michael@0 50 editor:textObj
michael@0 51 delegate:anObject
michael@0 52 event:theEvent];
michael@0 53 selectingOrEditing = NO;
michael@0 54 }
michael@0 55
michael@0 56 @end

mercurial