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

Side by Side Diff: Source/core/css/CSSGradientValue.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 // taking into account the moved origin and the fact that we're in drawing s pace (+y = down). 635 // taking into account the moved origin and the fact that we're in drawing s pace (+y = down).
636 secondPoint.set(halfWidth + endX, halfHeight - endY); 636 secondPoint.set(halfWidth + endX, halfHeight - endY);
637 // Reflect around the center for the start point. 637 // Reflect around the center for the start point.
638 firstPoint.set(halfWidth - endX, halfHeight + endY); 638 firstPoint.set(halfWidth - endX, halfHeight + endY);
639 } 639 }
640 640
641 PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render er, const IntSize& size) 641 PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render er, const IntSize& size)
642 { 642 {
643 ASSERT(!size.isEmpty()); 643 ASSERT(!size.isEmpty());
644 644
645 RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyl e(); 645 RenderStyle* rootStyle = renderer->document().documentElement()->renderStyle ();
646 646
647 FloatPoint firstPoint; 647 FloatPoint firstPoint;
648 FloatPoint secondPoint; 648 FloatPoint secondPoint;
649 if (m_angle) { 649 if (m_angle) {
650 float angle = m_angle->getFloatValue(CSSPrimitiveValue::CSS_DEG); 650 float angle = m_angle->getFloatValue(CSSPrimitiveValue::CSS_DEG);
651 endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType) ; 651 endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType) ;
652 } else { 652 } else {
653 switch (m_gradientType) { 653 switch (m_gradientType) {
654 case CSSDeprecatedLinearGradient: 654 case CSSDeprecatedLinearGradient:
655 firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), rendere r->style(), rootStyle, size); 655 firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), rendere r->style(), rootStyle, size);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 // a/b = aspectRatio, b = a/aspectRatio 977 // a/b = aspectRatio, b = a/aspectRatio
978 // a = sqrt(x^2 + y^2/(1/r^2)) 978 // a = sqrt(x^2 + y^2/(1/r^2))
979 return sqrtf(p.width() * p.width() + (p.height() * p.height()) / (1 / (aspec tRatio * aspectRatio))); 979 return sqrtf(p.width() * p.width() + (p.height() * p.height()) / (1 / (aspec tRatio * aspectRatio)));
980 } 980 }
981 981
982 // FIXME: share code with the linear version 982 // FIXME: share code with the linear version
983 PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render er, const IntSize& size) 983 PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render er, const IntSize& size)
984 { 984 {
985 ASSERT(!size.isEmpty()); 985 ASSERT(!size.isEmpty());
986 986
987 RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyl e(); 987 RenderStyle* rootStyle = renderer->document().documentElement()->renderStyle ();
988 988
989 FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), rend erer->style(), rootStyle, size); 989 FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), rend erer->style(), rootStyle, size);
990 if (!m_firstX) 990 if (!m_firstX)
991 firstPoint.setX(size.width() / 2); 991 firstPoint.setX(size.width() / 2);
992 if (!m_firstY) 992 if (!m_firstY)
993 firstPoint.setY(size.height() / 2); 993 firstPoint.setY(size.height() / 2);
994 994
995 FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), r enderer->style(), rootStyle, size); 995 FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), r enderer->style(), rootStyle, size);
996 if (!m_secondX) 996 if (!m_secondX)
997 secondPoint.setX(size.width() / 2); 997 secondPoint.setX(size.width() / 2);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize); 1164 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize);
1165 else { 1165 else {
1166 equalShape = !other.m_shape; 1166 equalShape = !other.m_shape;
1167 equalSizingBehavior = !other.m_sizingBehavior; 1167 equalSizingBehavior = !other.m_sizingBehavior;
1168 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize; 1168 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize;
1169 } 1169 }
1170 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops; 1170 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops;
1171 } 1171 }
1172 1172
1173 } // namespace WebCore 1173 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.cpp ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698