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

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

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

Powered by Google App Engine
This is Rietveld 408576698