| OLD | NEW |
| 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 *other.rare_non_inherited_data_.Get())) | 1005 *other.rare_non_inherited_data_.Get())) |
| 1006 diff.SetFilterChanged(); | 1006 diff.SetFilterChanged(); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 1009 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
| 1010 if (!rare_non_inherited_data_->outline_.VisuallyEqual( | 1010 if (!rare_non_inherited_data_->outline_.VisuallyEqual( |
| 1011 other.rare_non_inherited_data_->outline_)) | 1011 other.rare_non_inherited_data_->outline_)) |
| 1012 diff.SetNeedsRecomputeOverflow(); | 1012 diff.SetNeedsRecomputeOverflow(); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 if (!Border().VisualOverflowEqual(other.Border())) | 1015 if (!BorderVisualOverflowEqual(other)) |
| 1016 diff.SetNeedsRecomputeOverflow(); | 1016 diff.SetNeedsRecomputeOverflow(); |
| 1017 | 1017 |
| 1018 if (!diff.NeedsFullPaintInvalidation()) { | 1018 if (!diff.NeedsFullPaintInvalidation()) { |
| 1019 if (inherited_data_->color_ != other.inherited_data_->color_ || | 1019 if (inherited_data_->color_ != other.inherited_data_->color_ || |
| 1020 inherited_data_->visited_link_color_ != | 1020 inherited_data_->visited_link_color_ != |
| 1021 other.inherited_data_->visited_link_color_ || | 1021 other.inherited_data_->visited_link_color_ || |
| 1022 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || | 1022 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || |
| 1023 visual_data_->text_decoration_ != | 1023 visual_data_->text_decoration_ != |
| 1024 other.visual_data_->text_decoration_) { | 1024 other.visual_data_->text_decoration_) { |
| 1025 diff.SetTextDecorationOrColorChanged(); | 1025 diff.SetTextDecorationOrColorChanged(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 bool ComputedStyle::TextShadowDataEquivalent(const ComputedStyle& other) const { | 1376 bool ComputedStyle::TextShadowDataEquivalent(const ComputedStyle& other) const { |
| 1377 return DataEquivalent(TextShadow(), other.TextShadow()); | 1377 return DataEquivalent(TextShadow(), other.TextShadow()); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) { | 1380 void ComputedStyle::SetBoxShadow(PassRefPtr<ShadowList> s) { |
| 1381 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); | 1381 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border, | 1384 static FloatRoundedRect::Radii CalcRadiiFor(const LengthSize& top_left, |
| 1385 const LengthSize& top_left, | |
| 1386 const LengthSize& top_right, | 1385 const LengthSize& top_right, |
| 1387 const LengthSize& bottom_left, | 1386 const LengthSize& bottom_left, |
| 1388 const LengthSize& bottom_right, | 1387 const LengthSize& bottom_right, |
| 1389 LayoutSize size) { | 1388 LayoutSize size) { |
| 1390 return FloatRoundedRect::Radii( | 1389 return FloatRoundedRect::Radii( |
| 1391 FloatSize( | 1390 FloatSize( |
| 1392 FloatValueForLength(top_left.Width(), size.Width().ToFloat()), | 1391 FloatValueForLength(top_left.Width(), size.Width().ToFloat()), |
| 1393 FloatValueForLength(top_left.Height(), size.Height().ToFloat())), | 1392 FloatValueForLength(top_left.Height(), size.Height().ToFloat())), |
| 1394 FloatSize( | 1393 FloatSize( |
| 1395 FloatValueForLength(top_right.Width(), size.Width().ToFloat()), | 1394 FloatValueForLength(top_right.Width(), size.Width().ToFloat()), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1422 void ComputedStyle::SetVisitedLinkColor(const Color& v) { | 1421 void ComputedStyle::SetVisitedLinkColor(const Color& v) { |
| 1423 SET_VAR(inherited_data_, visited_link_color_, v); | 1422 SET_VAR(inherited_data_, visited_link_color_, v); |
| 1424 } | 1423 } |
| 1425 | 1424 |
| 1426 FloatRoundedRect ComputedStyle::GetRoundedBorderFor( | 1425 FloatRoundedRect ComputedStyle::GetRoundedBorderFor( |
| 1427 const LayoutRect& border_rect, | 1426 const LayoutRect& border_rect, |
| 1428 bool include_logical_left_edge, | 1427 bool include_logical_left_edge, |
| 1429 bool include_logical_right_edge) const { | 1428 bool include_logical_right_edge) const { |
| 1430 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); | 1429 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); |
| 1431 if (HasBorderRadius()) { | 1430 if (HasBorderRadius()) { |
| 1432 FloatRoundedRect::Radii radii = | 1431 FloatRoundedRect::Radii radii = CalcRadiiFor( |
| 1433 CalcRadiiFor(Border(), BorderTopLeftRadius(), BorderTopRightRadius(), | 1432 BorderTopLeftRadius(), BorderTopRightRadius(), BorderBottomLeftRadius(), |
| 1434 BorderBottomLeftRadius(), BorderBottomRightRadius(), | 1433 BorderBottomRightRadius(), border_rect.Size()); |
| 1435 border_rect.Size()); | |
| 1436 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), | 1434 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), |
| 1437 include_logical_left_edge, | 1435 include_logical_left_edge, |
| 1438 include_logical_right_edge); | 1436 include_logical_right_edge); |
| 1439 rounded_rect.ConstrainRadii(); | 1437 rounded_rect.ConstrainRadii(); |
| 1440 } | 1438 } |
| 1441 return rounded_rect; | 1439 return rounded_rect; |
| 1442 } | 1440 } |
| 1443 | 1441 |
| 1444 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( | 1442 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( |
| 1445 const LayoutRect& border_rect, | 1443 const LayoutRect& border_rect, |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 const NinePieceImage& image) const { | 2370 const NinePieceImage& image) const { |
| 2373 return LayoutRectOutsets( | 2371 return LayoutRectOutsets( |
| 2374 NinePieceImage::ComputeOutset(image.Outset().Top(), BorderTopWidth()), | 2372 NinePieceImage::ComputeOutset(image.Outset().Top(), BorderTopWidth()), |
| 2375 NinePieceImage::ComputeOutset(image.Outset().Right(), BorderRightWidth()), | 2373 NinePieceImage::ComputeOutset(image.Outset().Right(), BorderRightWidth()), |
| 2376 NinePieceImage::ComputeOutset(image.Outset().Bottom(), | 2374 NinePieceImage::ComputeOutset(image.Outset().Bottom(), |
| 2377 BorderBottomWidth()), | 2375 BorderBottomWidth()), |
| 2378 NinePieceImage::ComputeOutset(image.Outset().Left(), BorderLeftWidth())); | 2376 NinePieceImage::ComputeOutset(image.Outset().Left(), BorderLeftWidth())); |
| 2379 } | 2377 } |
| 2380 | 2378 |
| 2381 void ComputedStyle::SetBorderImageSource(StyleImage* image) { | 2379 void ComputedStyle::SetBorderImageSource(StyleImage* image) { |
| 2382 if (Border().image_.GetImage() == image) | 2380 if (BorderImage().GetImage() == image) |
| 2383 return; | 2381 return; |
| 2384 surround_data_.Access()->border_.image_.SetImage(image); | 2382 MutableBorderImageInternal().SetImage(image); |
| 2385 } | 2383 } |
| 2386 | 2384 |
| 2387 void ComputedStyle::SetBorderImageSlices(const LengthBox& slices) { | 2385 void ComputedStyle::SetBorderImageSlices(const LengthBox& slices) { |
| 2388 if (Border().image_.ImageSlices() == slices) | 2386 if (BorderImage().ImageSlices() == slices) |
| 2389 return; | 2387 return; |
| 2390 surround_data_.Access()->border_.image_.SetImageSlices(slices); | 2388 MutableBorderImageInternal().SetImageSlices(slices); |
| 2391 } | 2389 } |
| 2392 | 2390 |
| 2393 void ComputedStyle::SetBorderImageSlicesFill(bool fill) { | 2391 void ComputedStyle::SetBorderImageSlicesFill(bool fill) { |
| 2394 if (Border().image_.Fill() == fill) | 2392 if (BorderImage().Fill() == fill) |
| 2395 return; | 2393 return; |
| 2396 surround_data_.Access()->border_.image_.SetFill(fill); | 2394 MutableBorderImageInternal().SetFill(fill); |
| 2397 } | 2395 } |
| 2398 | 2396 |
| 2399 void ComputedStyle::SetBorderImageWidth(const BorderImageLengthBox& slices) { | 2397 void ComputedStyle::SetBorderImageWidth(const BorderImageLengthBox& slices) { |
| 2400 if (Border().image_.BorderSlices() == slices) | 2398 if (BorderImage().BorderSlices() == slices) |
| 2401 return; | 2399 return; |
| 2402 surround_data_.Access()->border_.image_.SetBorderSlices(slices); | 2400 MutableBorderImageInternal().SetBorderSlices(slices); |
| 2403 } | 2401 } |
| 2404 | 2402 |
| 2405 void ComputedStyle::SetBorderImageOutset(const BorderImageLengthBox& outset) { | 2403 void ComputedStyle::SetBorderImageOutset(const BorderImageLengthBox& outset) { |
| 2406 if (Border().image_.Outset() == outset) | 2404 if (BorderImage().Outset() == outset) |
| 2407 return; | 2405 return; |
| 2408 surround_data_.Access()->border_.image_.SetOutset(outset); | 2406 MutableBorderImageInternal().SetOutset(outset); |
| 2409 } | 2407 } |
| 2410 | 2408 |
| 2411 bool ComputedStyle::BorderObscuresBackground() const { | 2409 bool ComputedStyle::BorderObscuresBackground() const { |
| 2412 if (!HasBorder()) | 2410 if (!HasBorder()) |
| 2413 return false; | 2411 return false; |
| 2414 | 2412 |
| 2415 // Bail if we have any border-image for now. We could look at the image alpha | 2413 // Bail if we have any border-image for now. We could look at the image alpha |
| 2416 // to improve this. | 2414 // to improve this. |
| 2417 if (BorderImage().GetImage()) | 2415 if (BorderImage().GetImage()) |
| 2418 return false; | 2416 return false; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2492 if (value < 0) | 2490 if (value < 0) |
| 2493 fvalue -= 0.5f; | 2491 fvalue -= 0.5f; |
| 2494 else | 2492 else |
| 2495 fvalue += 0.5f; | 2493 fvalue += 0.5f; |
| 2496 } | 2494 } |
| 2497 | 2495 |
| 2498 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2496 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
| 2499 } | 2497 } |
| 2500 | 2498 |
| 2501 } // namespace blink | 2499 } // namespace blink |
| OLD | NEW |