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

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

Issue 2850173003: Move LengthSizes border-*-radius out of BorderData (Closed)
Patch Set: Rebase 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | 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) 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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } 888 }
889 889
890 return false; 890 return false;
891 } 891 }
892 892
893 bool ComputedStyle::DiffNeedsPaintInvalidationObject( 893 bool ComputedStyle::DiffNeedsPaintInvalidationObject(
894 const ComputedStyle& other) const { 894 const ComputedStyle& other) const {
895 if (Visibility() != other.Visibility() || 895 if (Visibility() != other.Visibility() ||
896 PrintColorAdjust() != other.PrintColorAdjust() || 896 PrintColorAdjust() != other.PrintColorAdjust() ||
897 InsideLink() != other.InsideLink() || 897 InsideLink() != other.InsideLink() ||
898 !Border().VisuallyEqual(other.Border()) || 898 !Border().VisuallyEqual(other.Border()) || !RadiiEqual(other) ||
899 *background_data_ != *other.background_data_) 899 *background_data_ != *other.background_data_)
900 return true; 900 return true;
901 901
902 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { 902 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) {
903 if (rare_inherited_data_->user_modify != 903 if (rare_inherited_data_->user_modify !=
904 other.rare_inherited_data_->user_modify || 904 other.rare_inherited_data_->user_modify ||
905 rare_inherited_data_->user_select != 905 rare_inherited_data_->user_select !=
906 other.rare_inherited_data_->user_select || 906 other.rare_inherited_data_->user_select ||
907 rare_inherited_data_->image_rendering_ != 907 rare_inherited_data_->image_rendering_ !=
908 other.rare_inherited_data_->image_rendering_) 908 other.rare_inherited_data_->image_rendering_)
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 1389
1390 void ComputedStyle::SetTextShadow(PassRefPtr<ShadowList> s) { 1390 void ComputedStyle::SetTextShadow(PassRefPtr<ShadowList> s) {
1391 rare_inherited_data_.Access()->text_shadow = std::move(s); 1391 rare_inherited_data_.Access()->text_shadow = std::move(s);
1392 } 1392 }
1393 1393
1394 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) { 1394 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) {
1395 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); 1395 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s);
1396 } 1396 }
1397 1397
1398 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border, 1398 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border,
1399 const LengthSize& top_left,
1400 const LengthSize& top_right,
1401 const LengthSize& bottom_left,
1402 const LengthSize& bottom_right,
1399 LayoutSize size) { 1403 LayoutSize size) {
1400 return FloatRoundedRect::Radii( 1404 return FloatRoundedRect::Radii(
1401 FloatSize( 1405 FloatSize(
1402 FloatValueForLength(border.TopLeft().Width(), size.Width().ToFloat()), 1406 FloatValueForLength(top_left.Width(), size.Width().ToFloat()),
1403 FloatValueForLength(border.TopLeft().Height(), 1407 FloatValueForLength(top_left.Height(), size.Height().ToFloat())),
1404 size.Height().ToFloat())), 1408 FloatSize(
1405 FloatSize(FloatValueForLength(border.TopRight().Width(), 1409 FloatValueForLength(top_right.Width(), size.Width().ToFloat()),
1406 size.Width().ToFloat()), 1410 FloatValueForLength(top_right.Height(), size.Height().ToFloat())),
1407 FloatValueForLength(border.TopRight().Height(), 1411 FloatSize(
1408 size.Height().ToFloat())), 1412 FloatValueForLength(bottom_left.Width(), size.Width().ToFloat()),
1409 FloatSize(FloatValueForLength(border.BottomLeft().Width(), 1413 FloatValueForLength(bottom_left.Height(), size.Height().ToFloat())),
1410 size.Width().ToFloat()), 1414 FloatSize(
1411 FloatValueForLength(border.BottomLeft().Height(), 1415 FloatValueForLength(bottom_right.Width(), size.Width().ToFloat()),
1412 size.Height().ToFloat())), 1416 FloatValueForLength(bottom_right.Height(), size.Height().ToFloat())));
1413 FloatSize(FloatValueForLength(border.BottomRight().Width(),
1414 size.Width().ToFloat()),
1415 FloatValueForLength(border.BottomRight().Height(),
1416 size.Height().ToFloat())));
1417 } 1417 }
1418 1418
1419 StyleImage* ComputedStyle::ListStyleImage() const { 1419 StyleImage* ComputedStyle::ListStyleImage() const {
1420 return rare_inherited_data_->list_style_image.Get(); 1420 return rare_inherited_data_->list_style_image.Get();
1421 } 1421 }
1422 void ComputedStyle::SetListStyleImage(StyleImage* v) { 1422 void ComputedStyle::SetListStyleImage(StyleImage* v) {
1423 if (rare_inherited_data_->list_style_image != v) 1423 if (rare_inherited_data_->list_style_image != v)
1424 rare_inherited_data_.Access()->list_style_image = v; 1424 rare_inherited_data_.Access()->list_style_image = v;
1425 } 1425 }
1426 1426
(...skipping 22 matching lines...) Expand all
1449 void ComputedStyle::SetVerticalBorderSpacing(short v) { 1449 void ComputedStyle::SetVerticalBorderSpacing(short v) {
1450 SET_VAR(inherited_data_, vertical_border_spacing_, v); 1450 SET_VAR(inherited_data_, vertical_border_spacing_, v);
1451 } 1451 }
1452 1452
1453 FloatRoundedRect ComputedStyle::GetRoundedBorderFor( 1453 FloatRoundedRect ComputedStyle::GetRoundedBorderFor(
1454 const LayoutRect& border_rect, 1454 const LayoutRect& border_rect,
1455 bool include_logical_left_edge, 1455 bool include_logical_left_edge,
1456 bool include_logical_right_edge) const { 1456 bool include_logical_right_edge) const {
1457 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); 1457 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect));
1458 if (HasBorderRadius()) { 1458 if (HasBorderRadius()) {
1459 FloatRoundedRect::Radii radii = CalcRadiiFor(Border(), border_rect.Size()); 1459 FloatRoundedRect::Radii radii =
1460 CalcRadiiFor(Border(), BorderTopLeftRadius(), BorderTopRightRadius(),
1461 BorderBottomLeftRadius(), BorderBottomRightRadius(),
1462 border_rect.Size());
1460 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), 1463 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(),
1461 include_logical_left_edge, 1464 include_logical_left_edge,
1462 include_logical_right_edge); 1465 include_logical_right_edge);
1463 rounded_rect.ConstrainRadii(); 1466 rounded_rect.ConstrainRadii();
1464 } 1467 }
1465 return rounded_rect; 1468 return rounded_rect;
1466 } 1469 }
1467 1470
1468 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( 1471 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor(
1469 const LayoutRect& border_rect, 1472 const LayoutRect& border_rect,
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 if (value < 0) 2497 if (value < 0)
2495 fvalue -= 0.5f; 2498 fvalue -= 0.5f;
2496 else 2499 else
2497 fvalue += 0.5f; 2500 fvalue += 0.5f;
2498 } 2501 }
2499 2502
2500 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2503 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2501 } 2504 }
2502 2505
2503 } // namespace blink 2506 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698