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

Side by Side Diff: Source/core/rendering/style/ShadowData.cpp

Issue 23241010: Support subpixel values for text-shadow and box-shadow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: found one more spot Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 || (m_next && o.m_next && *m_next != *o.m_next)) 44 || (m_next && o.m_next && *m_next != *o.m_next))
45 return false; 45 return false;
46 46
47 return m_location == o.m_location 47 return m_location == o.m_location
48 && m_blur == o.m_blur 48 && m_blur == o.m_blur
49 && m_spread == o.m_spread 49 && m_spread == o.m_spread
50 && m_style == o.m_style 50 && m_style == o.m_style
51 && m_color == o.m_color; 51 && m_color == o.m_color;
52 } 52 }
53 53
54 static inline void calculateShadowExtent(const ShadowData* shadow, int additiona lOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBott om) 54 static inline void calculateShadowExtent(const ShadowData* shadow, LayoutUnit ad ditionalOutlineSize, LayoutUnit& shadowLeft, LayoutUnit& shadowRight, LayoutUnit & shadowTop, LayoutUnit& shadowBottom)
55 { 55 {
56 do { 56 do {
57 int blurAndSpread = shadow->blur() + shadow->spread() + additionalOutlin eSize; 57 LayoutUnit blurAndSpread = shadow->blur() + shadow->spread() + additiona lOutlineSize;
58 if (shadow->style() == Normal) { 58 if (shadow->style() == Normal) {
59 shadowLeft = min(shadow->x() - blurAndSpread, shadowLeft); 59 shadowLeft = min(shadow->x() - blurAndSpread, shadowLeft);
60 shadowRight = max(shadow->x() + blurAndSpread, shadowRight); 60 shadowRight = max(shadow->x() + blurAndSpread, shadowRight);
61 shadowTop = min(shadow->y() - blurAndSpread, shadowTop); 61 shadowTop = min(shadow->y() - blurAndSpread, shadowTop);
62 shadowBottom = max(shadow->y() + blurAndSpread, shadowBottom); 62 shadowBottom = max(shadow->y() + blurAndSpread, shadowBottom);
63 } 63 }
64 64
65 shadow = shadow->next(); 65 shadow = shadow->next();
66 } while (shadow); 66 } while (shadow);
67 } 67 }
68 68
69 void ShadowData::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize ) const 69 void ShadowData::adjustRectForShadow(LayoutRect& rect, LayoutUnit additionalOutl ineSize) const
70 { 70 {
71 int shadowLeft = 0; 71 LayoutUnit shadowLeft = 0;
72 int shadowRight = 0; 72 LayoutUnit shadowRight = 0;
73 int shadowTop = 0; 73 LayoutUnit shadowTop = 0;
74 int shadowBottom = 0; 74 LayoutUnit shadowBottom = 0;
75 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); 75 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
76 76
77 rect.move(shadowLeft, shadowTop); 77 rect.move(shadowLeft, shadowTop);
78 rect.setWidth(rect.width() - shadowLeft + shadowRight); 78 rect.setWidth(rect.width() - shadowLeft + shadowRight);
79 rect.setHeight(rect.height() - shadowTop + shadowBottom); 79 rect.setHeight(rect.height() - shadowTop + shadowBottom);
80 } 80 }
81 81
82 void ShadowData::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize) const 82 void ShadowData::adjustRectForShadow(FloatRect& rect, LayoutUnit additionalOutli neSize) const
83 { 83 {
84 int shadowLeft = 0; 84 LayoutUnit shadowLeft = 0;
85 int shadowRight = 0; 85 LayoutUnit shadowRight = 0;
86 int shadowTop = 0; 86 LayoutUnit shadowTop = 0;
87 int shadowBottom = 0; 87 LayoutUnit shadowBottom = 0;
88 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); 88 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
89 89
90 rect.move(shadowLeft, shadowTop); 90 rect.move(shadowLeft, shadowTop);
91 rect.setWidth(rect.width() - shadowLeft + shadowRight); 91 rect.setWidth(rect.width() - shadowLeft + shadowRight);
92 rect.setHeight(rect.height() - shadowTop + shadowBottom); 92 rect.setHeight(rect.height() - shadowTop + shadowBottom);
93 } 93 }
94 94
95 } // namespace WebCore 95 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698