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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2614883007: Change computed style enums to be prefixed with 'k'. (Closed)
Patch Set: Rebase on ToT. Created 3 years, 11 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 7 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
8 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 8 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
9 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
10 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 10 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 const ComputedStyle** computedStyle = 0) { 669 const ComputedStyle** computedStyle = 0) {
670 const ComputedStyle* style = 670 const ComputedStyle* style =
671 (computedStyle || 671 (computedStyle ||
672 direction == CanvasRenderingContext2DState::DirectionInherit) 672 direction == CanvasRenderingContext2DState::DirectionInherit)
673 ? canvas->ensureComputedStyle() 673 ? canvas->ensureComputedStyle()
674 : nullptr; 674 : nullptr;
675 if (computedStyle) 675 if (computedStyle)
676 *computedStyle = style; 676 *computedStyle = style;
677 switch (direction) { 677 switch (direction) {
678 case CanvasRenderingContext2DState::DirectionInherit: 678 case CanvasRenderingContext2DState::DirectionInherit:
679 return style ? style->direction() : TextDirection::Ltr; 679 return style ? style->direction() : TextDirection::kLtr;
680 case CanvasRenderingContext2DState::DirectionRTL: 680 case CanvasRenderingContext2DState::DirectionRTL:
681 return TextDirection::Rtl; 681 return TextDirection::kRtl;
682 case CanvasRenderingContext2DState::DirectionLTR: 682 case CanvasRenderingContext2DState::DirectionLTR:
683 return TextDirection::Ltr; 683 return TextDirection::kLtr;
684 } 684 }
685 ASSERT_NOT_REACHED(); 685 ASSERT_NOT_REACHED();
686 return TextDirection::Ltr; 686 return TextDirection::kLtr;
687 } 687 }
688 688
689 String CanvasRenderingContext2D::direction() const { 689 String CanvasRenderingContext2D::direction() const {
690 if (state().getDirection() == CanvasRenderingContext2DState::DirectionInherit) 690 if (state().getDirection() == CanvasRenderingContext2DState::DirectionInherit)
691 canvas()->document().updateStyleAndLayoutTreeForNode(canvas()); 691 canvas()->document().updateStyleAndLayoutTreeForNode(canvas());
692 return toTextDirection(state().getDirection(), canvas()) == TextDirection::Rtl 692 return toTextDirection(state().getDirection(), canvas()) ==
693 TextDirection::kRtl
693 ? rtlDirectionString 694 ? rtlDirectionString
694 : ltrDirectionString; 695 : ltrDirectionString;
695 } 696 }
696 697
697 void CanvasRenderingContext2D::setDirection(const String& directionString) { 698 void CanvasRenderingContext2D::setDirection(const String& directionString) {
698 CanvasRenderingContext2DState::Direction direction; 699 CanvasRenderingContext2DState::Direction direction;
699 if (directionString == inheritDirectionString) 700 if (directionString == inheritDirectionString)
700 direction = CanvasRenderingContext2DState::DirectionInherit; 701 direction = CanvasRenderingContext2DState::DirectionInherit;
701 else if (directionString == rtlDirectionString) 702 else if (directionString == rtlDirectionString)
702 direction = CanvasRenderingContext2DState::DirectionRTL; 703 direction = CanvasRenderingContext2DState::DirectionRTL;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 DCHECK(fontData); 839 DCHECK(fontData);
839 if (!fontData) 840 if (!fontData)
840 return; 841 return;
841 const FontMetrics& fontMetrics = fontData->getFontMetrics(); 842 const FontMetrics& fontMetrics = fontData->getFontMetrics();
842 843
843 // FIXME: Need to turn off font smoothing. 844 // FIXME: Need to turn off font smoothing.
844 845
845 const ComputedStyle* computedStyle = 0; 846 const ComputedStyle* computedStyle = 0;
846 TextDirection direction = 847 TextDirection direction =
847 toTextDirection(state().getDirection(), canvas(), &computedStyle); 848 toTextDirection(state().getDirection(), canvas(), &computedStyle);
848 bool isRTL = direction == TextDirection::Rtl; 849 bool isRTL = direction == TextDirection::kRtl;
849 bool override = 850 bool override =
850 computedStyle ? isOverride(computedStyle->unicodeBidi()) : false; 851 computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;
851 852
852 TextRun textRun(text, 0, 0, TextRun::AllowTrailingExpansion, direction, 853 TextRun textRun(text, 0, 0, TextRun::AllowTrailingExpansion, direction,
853 override); 854 override);
854 textRun.setNormalizeSpace(true); 855 textRun.setNormalizeSpace(true);
855 // Draw the item text at the correct point. 856 // Draw the item text at the correct point.
856 FloatPoint location(x, y + getFontBaseline(fontMetrics)); 857 FloatPoint location(x, y + getFontBaseline(fontMetrics));
857 double fontWidth = font.width(textRun); 858 double fontWidth = font.width(textRun);
858 859
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1159 }
1159 return true; 1160 return true;
1160 } 1161 }
1161 1162
1162 void CanvasRenderingContext2D::resetUsageTracking() { 1163 void CanvasRenderingContext2D::resetUsageTracking() {
1163 UsageCounters newCounters; 1164 UsageCounters newCounters;
1164 m_usageCounters = newCounters; 1165 m_usageCounters = newCounters;
1165 } 1166 }
1166 1167
1167 } // namespace blink 1168 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698