| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other) { | 115 PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other) { |
| 116 return adoptRef(new ComputedStyle(other)); | 116 return adoptRef(new ComputedStyle(other)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 ALWAYS_INLINE ComputedStyle::ComputedStyle() | 119 ALWAYS_INLINE ComputedStyle::ComputedStyle() |
| 120 : ComputedStyleBase(), RefCounted<ComputedStyle>() { | 120 : ComputedStyleBase(), RefCounted<ComputedStyle>() { |
| 121 m_box.init(); | 121 m_box.init(); |
| 122 m_visual.init(); | 122 m_visual.init(); |
| 123 m_background.init(); | 123 m_background.init(); |
| 124 m_surround.init(); | |
| 125 m_rareNonInheritedData.init(); | 124 m_rareNonInheritedData.init(); |
| 126 m_rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); | 125 m_rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); |
| 127 m_rareNonInheritedData.access()->m_flexibleBox.init(); | 126 m_rareNonInheritedData.access()->m_flexibleBox.init(); |
| 128 m_rareNonInheritedData.access()->m_multiCol.init(); | 127 m_rareNonInheritedData.access()->m_multiCol.init(); |
| 129 m_rareNonInheritedData.access()->m_transform.init(); | 128 m_rareNonInheritedData.access()->m_transform.init(); |
| 130 m_rareNonInheritedData.access()->m_willChange.init(); | 129 m_rareNonInheritedData.access()->m_willChange.init(); |
| 131 m_rareNonInheritedData.access()->m_filter.init(); | 130 m_rareNonInheritedData.access()->m_filter.init(); |
| 132 m_rareNonInheritedData.access()->m_backdropFilter.init(); | 131 m_rareNonInheritedData.access()->m_backdropFilter.init(); |
| 133 m_rareNonInheritedData.access()->m_grid.init(); | 132 m_rareNonInheritedData.access()->m_grid.init(); |
| 134 m_rareNonInheritedData.access()->m_gridItem.init(); | 133 m_rareNonInheritedData.access()->m_gridItem.init(); |
| 135 m_rareNonInheritedData.access()->m_scrollSnap.init(); | 134 m_rareNonInheritedData.access()->m_scrollSnap.init(); |
| 136 m_rareInheritedData.init(); | 135 m_rareInheritedData.init(); |
| 137 m_styleInheritedData.init(); | 136 m_styleInheritedData.init(); |
| 138 m_svgStyle.init(); | 137 m_svgStyle.init(); |
| 139 } | 138 } |
| 140 | 139 |
| 141 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) | 140 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) |
| 142 : ComputedStyleBase(o), | 141 : ComputedStyleBase(o), |
| 143 RefCounted<ComputedStyle>(), | 142 RefCounted<ComputedStyle>(), |
| 144 m_box(o.m_box), | 143 m_box(o.m_box), |
| 145 m_visual(o.m_visual), | 144 m_visual(o.m_visual), |
| 146 m_background(o.m_background), | 145 m_background(o.m_background), |
| 147 m_surround(o.m_surround), | |
| 148 m_rareNonInheritedData(o.m_rareNonInheritedData), | 146 m_rareNonInheritedData(o.m_rareNonInheritedData), |
| 149 m_rareInheritedData(o.m_rareInheritedData), | 147 m_rareInheritedData(o.m_rareInheritedData), |
| 150 m_styleInheritedData(o.m_styleInheritedData), | 148 m_styleInheritedData(o.m_styleInheritedData), |
| 151 m_svgStyle(o.m_svgStyle), | 149 m_svgStyle(o.m_svgStyle), |
| 152 m_nonInheritedData(o.m_nonInheritedData) {} | 150 m_nonInheritedData(o.m_nonInheritedData) {} |
| 153 | 151 |
| 154 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, | 152 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, |
| 155 const ComputedStyle& newStyle) { | 153 const ComputedStyle& newStyle) { |
| 156 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle. | 154 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle. |
| 157 if (!oldStyle.hasAnyPublicPseudoStyles() && | 155 if (!oldStyle.hasAnyPublicPseudoStyles() && |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 m_styleInheritedData = inheritParent.m_styleInheritedData; | 330 m_styleInheritedData = inheritParent.m_styleInheritedData; |
| 333 if (m_svgStyle != inheritParent.m_svgStyle) | 331 if (m_svgStyle != inheritParent.m_svgStyle) |
| 334 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); | 332 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); |
| 335 } | 333 } |
| 336 | 334 |
| 337 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) { | 335 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) { |
| 338 ComputedStyleBase::copyNonInheritedFromCached(other); | 336 ComputedStyleBase::copyNonInheritedFromCached(other); |
| 339 m_box = other.m_box; | 337 m_box = other.m_box; |
| 340 m_visual = other.m_visual; | 338 m_visual = other.m_visual; |
| 341 m_background = other.m_background; | 339 m_background = other.m_background; |
| 342 m_surround = other.m_surround; | |
| 343 m_rareNonInheritedData = other.m_rareNonInheritedData; | 340 m_rareNonInheritedData = other.m_rareNonInheritedData; |
| 344 | 341 |
| 345 // The flags are copied one-by-one because m_nonInheritedData.m_contains a | 342 // The flags are copied one-by-one because m_nonInheritedData.m_contains a |
| 346 // bunch of stuff other than real style data. | 343 // bunch of stuff other than real style data. |
| 347 // See comments for each skipped flag below. | 344 // See comments for each skipped flag below. |
| 348 setOriginalDisplay( | 345 setOriginalDisplay( |
| 349 other.originalDisplay()); // Not generated in ComputedStyleBase. | 346 other.originalDisplay()); // Not generated in ComputedStyleBase. |
| 350 setVerticalAlign( | 347 setVerticalAlign( |
| 351 other.verticalAlign()); // Not generated in ComputedStyleBase | 348 other.verticalAlign()); // Not generated in ComputedStyleBase |
| 352 m_nonInheritedData.m_hasViewportUnits = | 349 m_nonInheritedData.m_hasViewportUnits = |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 478 |
| 482 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const { | 479 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const { |
| 483 // compare everything except the pseudoStyle pointer | 480 // compare everything except the pseudoStyle pointer |
| 484 return ComputedStyleBase::nonInheritedEqual(other) && | 481 return ComputedStyleBase::nonInheritedEqual(other) && |
| 485 originalDisplay() == | 482 originalDisplay() == |
| 486 other.originalDisplay() && // Not generated in ComputedStyleBase | 483 other.originalDisplay() && // Not generated in ComputedStyleBase |
| 487 verticalAlign() == | 484 verticalAlign() == |
| 488 other.verticalAlign() && // Not generated in ComputedStyleBase | 485 other.verticalAlign() && // Not generated in ComputedStyleBase |
| 489 m_box == other.m_box && | 486 m_box == other.m_box && |
| 490 m_visual == other.m_visual && m_background == other.m_background && | 487 m_visual == other.m_visual && m_background == other.m_background && |
| 491 m_surround == other.m_surround && | |
| 492 m_rareNonInheritedData == other.m_rareNonInheritedData && | 488 m_rareNonInheritedData == other.m_rareNonInheritedData && |
| 493 m_svgStyle->nonInheritedEqual(*other.m_svgStyle); | 489 m_svgStyle->nonInheritedEqual(*other.m_svgStyle); |
| 494 } | 490 } |
| 495 | 491 |
| 496 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const { | 492 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const { |
| 497 // This is a fast check that only looks if the data structures are shared. | 493 // This is a fast check that only looks if the data structures are shared. |
| 498 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? | 494 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? |
| 499 return ComputedStyleBase::inheritedEqual(other) && | 495 return ComputedStyleBase::inheritedEqual(other) && |
| 500 m_styleInheritedData.get() == other.m_styleInheritedData.get() && | 496 m_styleInheritedData.get() == other.m_styleInheritedData.get() && |
| 501 m_svgStyle.get() == other.m_svgStyle.get() && | 497 m_svgStyle.get() == other.m_svgStyle.get() && |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2498 if (value < 0) | 2494 if (value < 0) |
| 2499 fvalue -= 0.5f; | 2495 fvalue -= 0.5f; |
| 2500 else | 2496 else |
| 2501 fvalue += 0.5f; | 2497 fvalue += 0.5f; |
| 2502 } | 2498 } |
| 2503 | 2499 |
| 2504 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2500 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2505 } | 2501 } |
| 2506 | 2502 |
| 2507 } // namespace blink | 2503 } // namespace blink |
| OLD | NEW |