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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 // If top or bottom become auto/non-auto then it means we either have to solve | 503 // If top or bottom become auto/non-auto then it means we either have to solve |
504 // height based on the content or stop doing so | 504 // height based on the content or stop doing so |
505 // (http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height) | 505 // (http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height) |
506 // - either way requires a layout. | 506 // - either way requires a layout. |
507 return a.LogicalTop().IsAuto() != b.LogicalTop().IsAuto() || | 507 return a.LogicalTop().IsAuto() != b.LogicalTop().IsAuto() || |
508 a.LogicalBottom().IsAuto() != b.LogicalBottom().IsAuto(); | 508 a.LogicalBottom().IsAuto() != b.LogicalBottom().IsAuto(); |
509 } | 509 } |
510 | 510 |
511 StyleDifference ComputedStyle::VisualInvalidationDiff( | 511 StyleDifference ComputedStyle::VisualInvalidationDiff( |
512 const ComputedStyle& other) const { | 512 const ComputedStyle& other) const { |
513 // Note, we use .get() on each DataRef below because DataRef::operator== will | 513 // Note, we use .Get() on each DataRef below because DataRef::operator== will |
514 // do a deep compare, which is duplicate work when we're going to compare each | 514 // do a deep compare, which is duplicate work when we're going to compare each |
515 // property inside this function anyway. | 515 // property inside this function anyway. |
516 | 516 |
517 StyleDifference diff; | 517 StyleDifference diff; |
518 if (svg_style_.Get() != other.svg_style_.Get()) | 518 if (svg_style_.Get() != other.svg_style_.Get()) |
519 diff = svg_style_->Diff(other.svg_style_.Get()); | 519 diff = svg_style_->Diff(other.svg_style_.Get()); |
520 | 520 |
521 if ((!diff.NeedsFullLayout() || !diff.NeedsFullPaintInvalidation()) && | 521 if ((!diff.NeedsFullLayout() || !diff.NeedsFullPaintInvalidation()) && |
522 DiffNeedsFullLayoutAndPaintInvalidation(other)) { | 522 DiffNeedsFullLayoutAndPaintInvalidation(other)) { |
523 diff.SetNeedsFullLayout(); | 523 diff.SetNeedsFullLayout(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 if (diff.TransformChanged()) | 598 if (diff.TransformChanged()) |
599 return true; | 599 return true; |
600 | 600 |
601 return false; | 601 return false; |
602 } | 602 } |
603 | 603 |
604 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( | 604 bool ComputedStyle::DiffNeedsFullLayoutAndPaintInvalidation( |
605 const ComputedStyle& other) const { | 605 const ComputedStyle& other) const { |
606 // FIXME: Not all cases in this method need both full layout and paint | 606 // FIXME: Not all cases in this method need both full layout and paint |
607 // invalidation. | 607 // invalidation. |
608 // Should move cases into diffNeedsFullLayout() if | 608 // Should move cases into DiffNeedsFullLayout() if |
609 // - don't need paint invalidation at all; | 609 // - don't need paint invalidation at all; |
610 // - or the layoutObject knows how to exactly invalidate paints caused by the | 610 // - or the layoutObject knows how to exactly invalidate paints caused by the |
611 // layout change instead of forced full paint invalidation. | 611 // layout change instead of forced full paint invalidation. |
612 | 612 |
613 if (surround_.Get() != other.surround_.Get()) { | 613 if (surround_.Get() != other.surround_.Get()) { |
614 // If our border widths change, then we need to layout. Other changes to | 614 // If our border widths change, then we need to layout. Other changes to |
615 // borders only necessitate a paint invalidation. | 615 // borders only necessitate a paint invalidation. |
616 if (BorderLeftWidth() != other.BorderLeftWidth() || | 616 if (BorderLeftWidth() != other.BorderLeftWidth() || |
617 BorderTopWidth() != other.BorderTopWidth() || | 617 BorderTopWidth() != other.BorderTopWidth() || |
618 BorderBottomWidth() != other.BorderBottomWidth() || | 618 BorderBottomWidth() != other.BorderBottomWidth() || |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 828 |
829 if ((Visibility() == EVisibility::kCollapse) != | 829 if ((Visibility() == EVisibility::kCollapse) != |
830 (other.Visibility() == EVisibility::kCollapse)) | 830 (other.Visibility() == EVisibility::kCollapse)) |
831 return true; | 831 return true; |
832 | 832 |
833 if (HasPseudoStyle(kPseudoIdScrollbar) != | 833 if (HasPseudoStyle(kPseudoIdScrollbar) != |
834 other.HasPseudoStyle(kPseudoIdScrollbar)) | 834 other.HasPseudoStyle(kPseudoIdScrollbar)) |
835 return true; | 835 return true; |
836 | 836 |
837 // Movement of non-static-positioned object is special cased in | 837 // Movement of non-static-positioned object is special cased in |
838 // ComputedStyle::visualInvalidationDiff(). | 838 // ComputedStyle::VisualInvalidationDiff(). |
839 | 839 |
840 return false; | 840 return false; |
841 } | 841 } |
842 | 842 |
843 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { | 843 bool ComputedStyle::DiffNeedsFullLayout(const ComputedStyle& other) const { |
844 if (box_.Get() != other.box_.Get()) { | 844 if (box_.Get() != other.box_.Get()) { |
845 if (box_->Width() != other.box_->Width() || | 845 if (box_->Width() != other.box_->Width() || |
846 box_->MinWidth() != other.box_->MinWidth() || | 846 box_->MinWidth() != other.box_->MinWidth() || |
847 box_->MaxWidth() != other.box_->MaxWidth() || | 847 box_->MaxWidth() != other.box_->MaxWidth() || |
848 box_->Height() != other.box_->Height() || | 848 box_->Height() != other.box_->Height() || |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 CSSPaintValue* value = ToCSSPaintValue(image->CssValue()); | 969 CSSPaintValue* value = ToCSSPaintValue(image->CssValue()); |
970 | 970 |
971 // NOTE: If the invalidation properties vectors are null, we are invalid as | 971 // NOTE: If the invalidation properties vectors are null, we are invalid as |
972 // we haven't yet been painted (and can't provide the invalidation | 972 // we haven't yet been painted (and can't provide the invalidation |
973 // properties yet). | 973 // properties yet). |
974 if (!value->NativeInvalidationProperties() || | 974 if (!value->NativeInvalidationProperties() || |
975 !value->CustomInvalidationProperties()) | 975 !value->CustomInvalidationProperties()) |
976 return true; | 976 return true; |
977 | 977 |
978 for (CSSPropertyID property_id : *value->NativeInvalidationProperties()) { | 978 for (CSSPropertyID property_id : *value->NativeInvalidationProperties()) { |
979 // TODO(ikilpatrick): remove isInterpolableProperty check once | 979 // TODO(ikilpatrick): remove IsInterpolableProperty check once |
980 // CSSPropertyEquality::propertiesEqual correctly handles all properties. | 980 // CSSPropertyEquality::PropertiesEqual correctly handles all properties. |
981 if (!CSSPropertyMetadata::IsInterpolableProperty(property_id) || | 981 if (!CSSPropertyMetadata::IsInterpolableProperty(property_id) || |
982 !CSSPropertyEquality::PropertiesEqual(property_id, *this, other)) | 982 !CSSPropertyEquality::PropertiesEqual(property_id, *this, other)) |
983 return true; | 983 return true; |
984 } | 984 } |
985 | 985 |
986 if (InheritedVariables() || NonInheritedVariables() || | 986 if (InheritedVariables() || NonInheritedVariables() || |
987 other.InheritedVariables() || other.NonInheritedVariables()) { | 987 other.InheritedVariables() || other.NonInheritedVariables()) { |
988 for (const AtomicString& property : | 988 for (const AtomicString& property : |
989 *value->CustomInvalidationProperties()) { | 989 *value->CustomInvalidationProperties()) { |
990 if (!DataEquivalent(GetVariable(property), other.GetVariable(property))) | 990 if (!DataEquivalent(GetVariable(property), other.GetVariable(property))) |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 return false; | 1176 return false; |
1177 } | 1177 } |
1178 | 1178 |
1179 void ComputedStyle::UpdateIsStackingContext(bool is_document_element, | 1179 void ComputedStyle::UpdateIsStackingContext(bool is_document_element, |
1180 bool is_in_top_layer) { | 1180 bool is_in_top_layer) { |
1181 if (IsStackingContext()) | 1181 if (IsStackingContext()) |
1182 return; | 1182 return; |
1183 | 1183 |
1184 // Force a stacking context for transform-style: preserve-3d. This happens | 1184 // Force a stacking context for transform-style: preserve-3d. This happens |
1185 // even if preserves-3d is ignored due to a 'grouping property' being present | 1185 // even if preserves-3d is ignored due to a 'grouping property' being present |
1186 // which requires flattening. See ComputedStyle::usedTransformStyle3D() and | 1186 // which requires flattening. See ComputedStyle::UsedTransformStyle3D() and |
1187 // ComputedStyle::hasGroupingProperty(). | 1187 // ComputedStyle::HasGroupingProperty(). |
1188 // This is legacy behavior that is left ambiguous in the official specs. | 1188 // This is legacy behavior that is left ambiguous in the official specs. |
1189 // See crbug.com/663650 for more details." | 1189 // See crbug.com/663650 for more details." |
1190 if (TransformStyle3D() == kTransformStyle3DPreserve3D) { | 1190 if (TransformStyle3D() == kTransformStyle3DPreserve3D) { |
1191 SetIsStackingContext(true); | 1191 SetIsStackingContext(true); |
1192 return; | 1192 return; |
1193 } | 1193 } |
1194 | 1194 |
1195 if (is_document_element || is_in_top_layer || | 1195 if (is_document_element || is_in_top_layer || |
1196 StyleType() == kPseudoIdBackdrop || HasOpacity() || | 1196 StyleType() == kPseudoIdBackdrop || HasOpacity() || |
1197 HasTransformRelatedProperty() || HasMask() || ClipPath() || | 1197 HasTransformRelatedProperty() || HasMask() || ClipPath() || |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 if (value < 0) | 2503 if (value < 0) |
2504 fvalue -= 0.5f; | 2504 fvalue -= 0.5f; |
2505 else | 2505 else |
2506 fvalue += 0.5f; | 2506 fvalue += 0.5f; |
2507 } | 2507 } |
2508 | 2508 |
2509 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2509 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2510 } | 2510 } |
2511 | 2511 |
2512 } // namespace blink | 2512 } // namespace blink |
OLD | NEW |