| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 struct ComputedStyleBase { | 74 struct ComputedStyleBase { |
| 75 void* data_refs[6]; | 75 void* data_refs[6]; |
| 76 unsigned bitfields_[4]; | 76 unsigned bitfields_[4]; |
| 77 } base_; | 77 } base_; |
| 78 | 78 |
| 79 void* data_refs[1]; | 79 void* data_refs[1]; |
| 80 void* own_ptrs[1]; | 80 void* own_ptrs[1]; |
| 81 void* data_ref_svg_style; | 81 void* data_ref_svg_style; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 // If this fails, the packing algorithm in make_computed_style_base.py has | |
| 85 // failed to produce the optimal packed size. To fix, update the algorithm to | |
| 86 // ensure that the buckets are placed so that each takes up at most 1 word. | |
| 87 ASSERT_SIZE(ComputedStyleBase<ComputedStyle>, SameSizeAsComputedStyleBase); | |
| 88 | |
| 89 // If this assert fails, it means that size of ComputedStyle has changed. Please | 84 // If this assert fails, it means that size of ComputedStyle has changed. Please |
| 90 // check that you really *do* what to increase the size of ComputedStyle, then | 85 // check that you really *do* what to increase the size of ComputedStyle, then |
| 91 // update the SameSizeAsComputedStyle struct to match the updated storage of | 86 // update the SameSizeAsComputedStyle struct to match the updated storage of |
| 92 // ComputedStyle. | 87 // ComputedStyle. |
| 93 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); | 88 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); |
| 94 | 89 |
| 95 RefPtr<ComputedStyle> ComputedStyle::Create() { | 90 RefPtr<ComputedStyle> ComputedStyle::Create() { |
| 96 return AdoptRef(new ComputedStyle(InitialStyle())); | 91 return AdoptRef(new ComputedStyle(InitialStyle())); |
| 97 } | 92 } |
| 98 | 93 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // Animations don't need to be checked either. We always set the new style on | 524 // Animations don't need to be checked either. We always set the new style on |
| 530 // the layoutObject, so we will get a chance to fire off the resulting | 525 // the layoutObject, so we will get a chance to fire off the resulting |
| 531 // transition properly. | 526 // transition properly. |
| 532 | 527 |
| 533 return diff; | 528 return diff; |
| 534 } | 529 } |
| 535 | 530 |
| 536 bool ComputedStyle::ScrollAnchorDisablingPropertyChanged( | 531 bool ComputedStyle::ScrollAnchorDisablingPropertyChanged( |
| 537 const ComputedStyle& other, | 532 const ComputedStyle& other, |
| 538 const StyleDifference& diff) const { | 533 const StyleDifference& diff) const { |
| 539 if (ComputedStyleBase::ScrollAnchorDisablingPropertyChanged(other)) | 534 if (ComputedStyleBase::ScrollAnchorDisablingPropertyChanged(*this, other)) |
| 540 return true; | 535 return true; |
| 541 | 536 |
| 542 if (diff.TransformChanged()) | 537 if (diff.TransformChanged()) |
| 543 return true; | 538 return true; |
| 544 | 539 |
| 545 return false; | 540 return false; |
| 546 } | 541 } |
| 547 | 542 |
| 548 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( | 543 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( |
| 549 const ComputedStyle& other) const { | 544 const ComputedStyle& other) const { |
| 550 // FIXME: Not all cases in this method need both full layout and paint | 545 // FIXME: Not all cases in this method need both full layout and paint |
| 551 // invalidation. | 546 // invalidation. |
| 552 // Should move cases into DiffNeedsFullLayout() if | 547 // Should move cases into DiffNeedsFullLayout() if |
| 553 // - don't need paint invalidation at all; | 548 // - don't need paint invalidation at all; |
| 554 // - or the layoutObject knows how to exactly invalidate paints caused by the | 549 // - or the layoutObject knows how to exactly invalidate paints caused by the |
| 555 // layout change instead of forced full paint invalidation. | 550 // layout change instead of forced full paint invalidation. |
| 556 | 551 |
| 557 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(other)) | 552 if (ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation(*this, other)) |
| 558 return true; | 553 return true; |
| 559 | 554 |
| 560 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 555 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
| 561 if (rare_non_inherited_data_->appearance_ != | 556 if (rare_non_inherited_data_->appearance_ != |
| 562 other.rare_non_inherited_data_->appearance_ || | 557 other.rare_non_inherited_data_->appearance_ || |
| 563 rare_non_inherited_data_->margin_before_collapse_ != | 558 rare_non_inherited_data_->margin_before_collapse_ != |
| 564 other.rare_non_inherited_data_->margin_before_collapse_ || | 559 other.rare_non_inherited_data_->margin_before_collapse_ || |
| 565 rare_non_inherited_data_->margin_after_collapse_ != | 560 rare_non_inherited_data_->margin_after_collapse_ != |
| 566 other.rare_non_inherited_data_->margin_after_collapse_ || | 561 other.rare_non_inherited_data_->margin_after_collapse_ || |
| 567 rare_non_inherited_data_->line_clamp_ != | 562 rare_non_inherited_data_->line_clamp_ != |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 // selfNeedsSimplifiedLayout bit in order to not get confused and taint | 620 // selfNeedsSimplifiedLayout bit in order to not get confused and taint |
| 626 // every line). In addition we need to solve the floating object issue | 621 // every line). In addition we need to solve the floating object issue |
| 627 // when layers come and go. Right now a full layout is necessary to keep | 622 // when layers come and go. Right now a full layout is necessary to keep |
| 628 // floating object lists sane. | 623 // floating object lists sane. |
| 629 return true; | 624 return true; |
| 630 } | 625 } |
| 631 } | 626 } |
| 632 | 627 |
| 633 if (IsDisplayTableType(Display())) { | 628 if (IsDisplayTableType(Display())) { |
| 634 if (ComputedStyleBase:: | 629 if (ComputedStyleBase:: |
| 635 DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType(other)) | 630 DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType(*this, |
| 631 other)) |
| 636 return true; | 632 return true; |
| 637 | 633 |
| 638 // In the collapsing border model, 'hidden' suppresses other borders, while | 634 // In the collapsing border model, 'hidden' suppresses other borders, while |
| 639 // 'none' does not, so these style differences can be width differences. | 635 // 'none' does not, so these style differences can be width differences. |
| 640 if ((BorderCollapse() == EBorderCollapse::kCollapse) && | 636 if ((BorderCollapse() == EBorderCollapse::kCollapse) && |
| 641 ((BorderTopStyle() == EBorderStyle::kHidden && | 637 ((BorderTopStyle() == EBorderStyle::kHidden && |
| 642 other.BorderTopStyle() == EBorderStyle::kNone) || | 638 other.BorderTopStyle() == EBorderStyle::kNone) || |
| 643 (BorderTopStyle() == EBorderStyle::kNone && | 639 (BorderTopStyle() == EBorderStyle::kNone && |
| 644 other.BorderTopStyle() == EBorderStyle::kHidden) || | 640 other.BorderTopStyle() == EBorderStyle::kHidden) || |
| 645 (BorderBottomStyle() == EBorderStyle::kHidden && | 641 (BorderBottomStyle() == EBorderStyle::kHidden && |
| 646 other.BorderBottomStyle() == EBorderStyle::kNone) || | 642 other.BorderBottomStyle() == EBorderStyle::kNone) || |
| 647 (BorderBottomStyle() == EBorderStyle::kNone && | 643 (BorderBottomStyle() == EBorderStyle::kNone && |
| 648 other.BorderBottomStyle() == EBorderStyle::kHidden) || | 644 other.BorderBottomStyle() == EBorderStyle::kHidden) || |
| 649 (BorderLeftStyle() == EBorderStyle::kHidden && | 645 (BorderLeftStyle() == EBorderStyle::kHidden && |
| 650 other.BorderLeftStyle() == EBorderStyle::kNone) || | 646 other.BorderLeftStyle() == EBorderStyle::kNone) || |
| 651 (BorderLeftStyle() == EBorderStyle::kNone && | 647 (BorderLeftStyle() == EBorderStyle::kNone && |
| 652 other.BorderLeftStyle() == EBorderStyle::kHidden) || | 648 other.BorderLeftStyle() == EBorderStyle::kHidden) || |
| 653 (BorderRightStyle() == EBorderStyle::kHidden && | 649 (BorderRightStyle() == EBorderStyle::kHidden && |
| 654 other.BorderRightStyle() == EBorderStyle::kNone) || | 650 other.BorderRightStyle() == EBorderStyle::kNone) || |
| 655 (BorderRightStyle() == EBorderStyle::kNone && | 651 (BorderRightStyle() == EBorderStyle::kNone && |
| 656 other.BorderRightStyle() == EBorderStyle::kHidden))) | 652 other.BorderRightStyle() == EBorderStyle::kHidden))) |
| 657 return true; | 653 return true; |
| 658 } else if (Display() == EDisplay::kListItem) { | 654 } else if (Display() == EDisplay::kListItem) { |
| 659 if (ComputedStyleBase:: | 655 if (ComputedStyleBase:: |
| 660 DiffNeedsFullLayoutAndPaintInvalidationDisplayListItem(other)) | 656 DiffNeedsFullLayoutAndPaintInvalidationDisplayListItem(*this, |
| 657 other)) |
| 661 return true; | 658 return true; |
| 662 } | 659 } |
| 663 | 660 |
| 664 if ((Visibility() == EVisibility::kCollapse) != | 661 if ((Visibility() == EVisibility::kCollapse) != |
| 665 (other.Visibility() == EVisibility::kCollapse)) | 662 (other.Visibility() == EVisibility::kCollapse)) |
| 666 return true; | 663 return true; |
| 667 | 664 |
| 668 // Movement of non-static-positioned object is special cased in | 665 // Movement of non-static-positioned object is special cased in |
| 669 // ComputedStyle::VisualInvalidationDiff(). | 666 // ComputedStyle::VisualInvalidationDiff(). |
| 670 | 667 |
| 671 return false; | 668 return false; |
| 672 } | 669 } |
| 673 | 670 |
| 674 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { | 671 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { |
| 675 if (ComputedStyleBase::DiffNeedsFullLayout(other)) | 672 if (ComputedStyleBase::DiffNeedsFullLayout(*this, other)) |
| 676 return true; | 673 return true; |
| 677 | 674 |
| 678 if (box_data_.Get() != other.box_data_.Get()) { | 675 if (box_data_.Get() != other.box_data_.Get()) { |
| 679 if (box_data_->vertical_align_length_ != | 676 if (box_data_->vertical_align_length_ != |
| 680 other.box_data_->vertical_align_length_) | 677 other.box_data_->vertical_align_length_) |
| 681 return true; | 678 return true; |
| 682 } | 679 } |
| 683 | 680 |
| 684 if (VerticalAlign() != other.VerticalAlign() || | 681 if (VerticalAlign() != other.VerticalAlign() || |
| 685 GetPosition() != other.GetPosition()) | 682 GetPosition() != other.GetPosition()) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 rare_non_inherited_data_->mask_box_image_ != | 717 rare_non_inherited_data_->mask_box_image_ != |
| 721 other.rare_non_inherited_data_->mask_box_image_) | 718 other.rare_non_inherited_data_->mask_box_image_) |
| 722 return true; | 719 return true; |
| 723 } | 720 } |
| 724 | 721 |
| 725 return false; | 722 return false; |
| 726 } | 723 } |
| 727 | 724 |
| 728 bool ComputedStyle::DiffNeedsPaintInvalidationObject( | 725 bool ComputedStyle::DiffNeedsPaintInvalidationObject( |
| 729 const ComputedStyle& other) const { | 726 const ComputedStyle& other) const { |
| 730 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(other)) | 727 if (ComputedStyleBase::DiffNeedsPaintInvalidationObject(*this, other)) |
| 731 return true; | 728 return true; |
| 732 | 729 |
| 733 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || | 730 if (!BorderVisuallyEqual(other) || !RadiiEqual(other) || |
| 734 *background_data_ != *other.background_data_) | 731 *background_data_ != *other.background_data_) |
| 735 return true; | 732 return true; |
| 736 | 733 |
| 737 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { | 734 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { |
| 738 if (rare_non_inherited_data_->user_drag_ != | 735 if (rare_non_inherited_data_->user_drag_ != |
| 739 other.rare_non_inherited_data_->user_drag_ || | 736 other.rare_non_inherited_data_->user_drag_ || |
| 740 rare_non_inherited_data_->object_fit_ != | 737 rare_non_inherited_data_->object_fit_ != |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 } | 801 } |
| 805 | 802 |
| 806 return false; | 803 return false; |
| 807 } | 804 } |
| 808 | 805 |
| 809 // This doesn't include conditions needing layout or overflow recomputation | 806 // This doesn't include conditions needing layout or overflow recomputation |
| 810 // which implies visual rect update. | 807 // which implies visual rect update. |
| 811 bool ComputedStyle::DiffNeedsVisualRectUpdate( | 808 bool ComputedStyle::DiffNeedsVisualRectUpdate( |
| 812 const ComputedStyle& other) const { | 809 const ComputedStyle& other) const { |
| 813 // Visual rect is empty if visibility is hidden. | 810 // Visual rect is empty if visibility is hidden. |
| 814 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(other)) | 811 if (ComputedStyleBase::DiffNeedsVisualRectUpdate(*this, other)) |
| 815 return true; | 812 return true; |
| 816 | 813 |
| 817 // Need to update visual rect of the resizer. | 814 // Need to update visual rect of the resizer. |
| 818 if (Resize() != other.Resize()) | 815 if (Resize() != other.Resize()) |
| 819 return true; | 816 return true; |
| 820 | 817 |
| 821 return false; | 818 return false; |
| 822 } | 819 } |
| 823 | 820 |
| 824 void ComputedStyle::UpdatePropertySpecificDifferences( | 821 void ComputedStyle::UpdatePropertySpecificDifferences( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 (rare_non_inherited_data_.Get() != | 877 (rare_non_inherited_data_.Get() != |
| 881 other.rare_non_inherited_data_.Get() && | 878 other.rare_non_inherited_data_.Get() && |
| 882 (rare_non_inherited_data_->text_decoration_style_ != | 879 (rare_non_inherited_data_->text_decoration_style_ != |
| 883 other.rare_non_inherited_data_->text_decoration_style_ || | 880 other.rare_non_inherited_data_->text_decoration_style_ || |
| 884 rare_non_inherited_data_->text_decoration_color_ != | 881 rare_non_inherited_data_->text_decoration_color_ != |
| 885 other.rare_non_inherited_data_->text_decoration_color_ || | 882 other.rare_non_inherited_data_->text_decoration_color_ || |
| 886 rare_non_inherited_data_->visited_link_text_decoration_color_ != | 883 rare_non_inherited_data_->visited_link_text_decoration_color_ != |
| 887 other.rare_non_inherited_data_ | 884 other.rare_non_inherited_data_ |
| 888 ->visited_link_text_decoration_color_)) || | 885 ->visited_link_text_decoration_color_)) || |
| 889 ComputedStyleBase:: | 886 ComputedStyleBase:: |
| 890 UpdatePropertySpecificDifferencesTextDecorationOrColor(other)) { | 887 UpdatePropertySpecificDifferencesTextDecorationOrColor(*this, |
| 888 other)) { |
| 891 diff.SetTextDecorationOrColorChanged(); | 889 diff.SetTextDecorationOrColorChanged(); |
| 892 } | 890 } |
| 893 } | 891 } |
| 894 | 892 |
| 895 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; | 893 bool has_clip = HasOutOfFlowPosition() && !visual_data_->has_auto_clip_; |
| 896 bool other_has_clip = | 894 bool other_has_clip = |
| 897 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; | 895 other.HasOutOfFlowPosition() && !other.visual_data_->has_auto_clip_; |
| 898 if (has_clip != other_has_clip || | 896 if (has_clip != other_has_clip || |
| 899 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) | 897 (has_clip && visual_data_->clip_ != other.visual_data_->clip_)) |
| 900 diff.SetCSSClipChanged(); | 898 diff.SetCSSClipChanged(); |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 if (value < 0) | 2347 if (value < 0) |
| 2350 fvalue -= 0.5f; | 2348 fvalue -= 0.5f; |
| 2351 else | 2349 else |
| 2352 fvalue += 0.5f; | 2350 fvalue += 0.5f; |
| 2353 } | 2351 } |
| 2354 | 2352 |
| 2355 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2353 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
| 2356 } | 2354 } |
| 2357 | 2355 |
| 2358 } // namespace blink | 2356 } // namespace blink |
| OLD | NEW |