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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.h

Issue 2386033002: Scale focus outline thickness with zoom level. (Closed)
Patch Set: return if outline width is 0 Created 4 years, 2 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) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 3 * Copyright (C) 2008-2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 DrawLooperBuilder::ShadowAlphaMode = 297 DrawLooperBuilder::ShadowAlphaMode =
298 DrawLooperBuilder::ShadowRespectsAlpha, 298 DrawLooperBuilder::ShadowRespectsAlpha,
299 ShadowMode = DrawShadowAndForeground); 299 ShadowMode = DrawShadowAndForeground);
300 300
301 // It is assumed that this draw looper is used only for shadows 301 // It is assumed that this draw looper is used only for shadows
302 // (i.e. a draw looper is set if and only if there is a shadow). 302 // (i.e. a draw looper is set if and only if there is a shadow).
303 // The builder passed into this method will be destroyed. 303 // The builder passed into this method will be destroyed.
304 void setDrawLooper(std::unique_ptr<DrawLooperBuilder>); 304 void setDrawLooper(std::unique_ptr<DrawLooperBuilder>);
305 305
306 void drawFocusRing(const Vector<IntRect>&, 306 void drawFocusRing(const Vector<IntRect>&,
307 int width, 307 float width,
308 int offset, 308 int offset,
309 const Color&); 309 const Color&);
310 void drawFocusRing(const Path&, int width, int offset, const Color&); 310 void drawFocusRing(const Path&, float width, int offset, const Color&);
311 311
312 enum Edge { 312 enum Edge {
313 NoEdge = 0, 313 NoEdge = 0,
314 TopEdge = 1 << 1, 314 TopEdge = 1 << 1,
315 RightEdge = 1 << 2, 315 RightEdge = 1 << 2,
316 BottomEdge = 1 << 3, 316 BottomEdge = 1 << 3,
317 LeftEdge = 1 << 4 317 LeftEdge = 1 << 4
318 }; 318 };
319 typedef unsigned Edges; 319 typedef unsigned Edges;
320 void drawInnerShadow(const FloatRoundedRect&, 320 void drawInnerShadow(const FloatRoundedRect&,
(...skipping 30 matching lines...) Expand all
351 void setURLDestinationLocation(const String& name, const IntPoint&); 351 void setURLDestinationLocation(const String& name, const IntPoint&);
352 352
353 static void adjustLineToPixelBoundaries(FloatPoint& p1, 353 static void adjustLineToPixelBoundaries(FloatPoint& p1,
354 FloatPoint& p2, 354 FloatPoint& p2,
355 float strokeWidth, 355 float strokeWidth,
356 StrokeStyle); 356 StrokeStyle);
357 357
358 static int focusRingOutsetExtent(int offset, int width) { 358 static int focusRingOutsetExtent(int offset, int width) {
359 // Unlike normal outlines (whole width is outside of the offset), focus ring s are drawn with the 359 // Unlike normal outlines (whole width is outside of the offset), focus ring s are drawn with the
360 // center of the path aligned with the offset, so only half of the width is outside of the offset. 360 // center of the path aligned with the offset, so only half of the width is outside of the offset.
361 return focusRingOffset(offset) + (focusRingWidth(width) + 1) / 2; 361 return focusRingOffset(offset) + (focusRingWidth(width) + 1) / 2;
chrishtr 2016/10/07 21:14:21 Change this call site to focusRingWidth also?
Bret 2016/10/08 01:32:40 Done. Not sure what this callsite is for, somethin
362 } 362 }
363 363
364 #if OS(MACOSX) 364 #if OS(MACOSX)
365 static int focusRingWidth(int width) { return width; } 365 static int focusRingWidth(int width) { return width; }
chrishtr 2016/10/07 21:14:21 change to float?
Bret 2016/10/08 01:32:40 This is deleted.
366 #else 366 #else
367 static int focusRingWidth(int width) { return 1; } 367 static int focusRingWidth(int width) { return 1; }
chrishtr 2016/10/07 21:14:21 Doesn't this defeat the purpose of this feature?
Bret 2016/10/08 01:32:40 I just forgot to delete this block. I moved this i
368 #endif 368 #endif
369 369
370 #if DCHECK_IS_ON() 370 #if DCHECK_IS_ON()
371 void setInDrawingRecorder(bool); 371 void setInDrawingRecorder(bool);
372 #endif 372 #endif
373 373
374 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter); 374 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter);
375 375
376 private: 376 private:
377 const GraphicsContextState* immutableState() const { return m_paintState; } 377 const GraphicsContextState* immutableState() const { return m_paintState; }
(...skipping 14 matching lines...) Expand all
392 static SkPMColor antiColors1(int); 392 static SkPMColor antiColors1(int);
393 static SkPMColor antiColors2(int); 393 static SkPMColor antiColors2(int);
394 static void draw1xMarker(SkBitmap*, int); 394 static void draw1xMarker(SkBitmap*, int);
395 static void draw2xMarker(SkBitmap*, int); 395 static void draw2xMarker(SkBitmap*, int);
396 #endif 396 #endif
397 397
398 void saveLayer(const SkRect* bounds, const SkPaint*); 398 void saveLayer(const SkRect* bounds, const SkPaint*);
399 void restoreLayer(); 399 void restoreLayer();
400 400
401 // Helpers for drawing a focus ring (drawFocusRing) 401 // Helpers for drawing a focus ring (drawFocusRing)
402 void drawFocusRingPath(const SkPath&, const Color&, int width); 402 void drawFocusRingPath(const SkPath&, const Color&, float width);
403 void drawFocusRingRect(const SkRect&, const Color&, int width); 403 void drawFocusRingRect(const SkRect&, const Color&, float width);
404 404
405 // SkCanvas wrappers. 405 // SkCanvas wrappers.
406 void clipRRect(const SkRRect&, 406 void clipRRect(const SkRRect&,
407 AntiAliasingMode = NotAntiAliased, 407 AntiAliasingMode = NotAntiAliased,
408 SkRegion::Op = SkRegion::kIntersect_Op); 408 SkRegion::Op = SkRegion::kIntersect_Op);
409 void concat(const SkMatrix&); 409 void concat(const SkMatrix&);
410 410
411 // Apply deferred paint state saves 411 // Apply deferred paint state saves
412 void realizePaintSave() { 412 void realizePaintSave() {
413 if (contextDisabled()) 413 if (contextDisabled())
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 462
463 float m_deviceScaleFactor; 463 float m_deviceScaleFactor;
464 464
465 unsigned m_printing : 1; 465 unsigned m_printing : 1;
466 unsigned m_hasMetaData : 1; 466 unsigned m_hasMetaData : 1;
467 }; 467 };
468 468
469 } // namespace blink 469 } // namespace blink
470 470
471 #endif // GraphicsContext_h 471 #endif // GraphicsContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698