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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2881673003: CSS Motion Path: Support parsing of ray(<angle>) paths (Closed)
Patch Set: DCHECK_EQ Created 3 years, 7 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 const FloatRect& bounding_box, 1337 const FloatRect& bounding_box,
1338 TransformationMatrix& transform) const { 1338 TransformationMatrix& transform) const {
1339 const StyleMotionData& motion_data = 1339 const StyleMotionData& motion_data =
1340 rare_non_inherited_data_->transform_->motion_; 1340 rare_non_inherited_data_->transform_->motion_;
1341 // TODO(ericwilligers): crbug.com/638055 Apply offset-position. 1341 // TODO(ericwilligers): crbug.com/638055 Apply offset-position.
1342 if (!motion_data.path_) { 1342 if (!motion_data.path_) {
1343 return; 1343 return;
1344 } 1344 }
1345 const LengthPoint& position = OffsetPosition(); 1345 const LengthPoint& position = OffsetPosition();
1346 const LengthPoint& anchor = OffsetAnchor(); 1346 const LengthPoint& anchor = OffsetAnchor();
1347 const StylePath& motion_path = *motion_data.path_; 1347 if (motion_data.path_->GetType() == BasicShape::kStyleRayType) {
1348 // TODO(ericwilligers): crbug.com/641245 Support ray paths.
1349 return;
1350 }
1351 const StylePath& motion_path = ToStylePath(*motion_data.path_);
1348 float path_length = motion_path.length(); 1352 float path_length = motion_path.length();
1349 float distance = FloatValueForLength(motion_data.distance_, path_length); 1353 float distance = FloatValueForLength(motion_data.distance_, path_length);
1350 float computed_distance; 1354 float computed_distance;
1351 if (motion_path.IsClosed() && path_length > 0) { 1355 if (motion_path.IsClosed() && path_length > 0) {
1352 computed_distance = fmod(distance, path_length); 1356 computed_distance = fmod(distance, path_length);
1353 if (computed_distance < 0) 1357 if (computed_distance < 0)
1354 computed_distance += path_length; 1358 computed_distance += path_length;
1355 } else { 1359 } else {
1356 computed_distance = clampTo<float>(distance, 0, path_length); 1360 computed_distance = clampTo<float>(distance, 0, path_length);
1357 } 1361 }
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 else 2330 else
2327 SetMarginLeft(margin); 2331 SetMarginLeft(margin);
2328 } else { 2332 } else {
2329 if (IsLeftToRightDirection()) 2333 if (IsLeftToRightDirection())
2330 SetMarginBottom(margin); 2334 SetMarginBottom(margin);
2331 else 2335 else
2332 SetMarginTop(margin); 2336 SetMarginTop(margin);
2333 } 2337 }
2334 } 2338 }
2335 2339
2336 void ComputedStyle::SetOffsetPath(PassRefPtr<StylePath> path) { 2340 void ComputedStyle::SetOffsetPath(PassRefPtr<BasicShape> path) {
2337 rare_non_inherited_data_.Access()->transform_.Access()->motion_.path_ = 2341 rare_non_inherited_data_.Access()->transform_.Access()->motion_.path_ =
2338 std::move(path); 2342 std::move(path);
2339 } 2343 }
2340 2344
2341 int ComputedStyle::OutlineOutsetExtent() const { 2345 int ComputedStyle::OutlineOutsetExtent() const {
2342 if (!HasOutline()) 2346 if (!HasOutline())
2343 return 0; 2347 return 0;
2344 if (OutlineStyleIsAuto()) { 2348 if (OutlineStyleIsAuto()) {
2345 return GraphicsContext::FocusRingOutsetExtent( 2349 return GraphicsContext::FocusRingOutsetExtent(
2346 OutlineOffset(), std::ceil(GetOutlineStrokeWidthForFocusRing())); 2350 OutlineOffset(), std::ceil(GetOutlineStrokeWidthForFocusRing()));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 if (value < 0) 2522 if (value < 0)
2519 fvalue -= 0.5f; 2523 fvalue -= 0.5f;
2520 else 2524 else
2521 fvalue += 0.5f; 2525 fvalue += 0.5f;
2522 } 2526 }
2523 2527
2524 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2528 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2525 } 2529 }
2526 2530
2527 } // namespace blink 2531 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698