| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 if (oldStyle->display() != newStyle->display() || | 206 if (oldStyle->display() != newStyle->display() || |
| 207 oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != | 207 oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != |
| 208 newStyle->hasPseudoStyle(PseudoIdFirstLetter) || | 208 newStyle->hasPseudoStyle(PseudoIdFirstLetter) || |
| 209 !oldStyle->contentDataEquivalent(newStyle) || | 209 !oldStyle->contentDataEquivalent(newStyle) || |
| 210 oldStyle->hasTextCombine() != newStyle->hasTextCombine()) | 210 oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
| 211 return Reattach; | 211 return Reattach; |
| 212 | 212 |
| 213 bool independentEqual = oldStyle->independentInheritedEqual(*newStyle); | 213 bool independentEqual = oldStyle->independentInheritedEqual(*newStyle); |
| 214 bool nonIndependentEqual = oldStyle->nonIndependentInheritedEqual(*newStyle); | 214 bool nonIndependentEqual = oldStyle->nonIndependentInheritedEqual(*newStyle); |
| 215 if (!independentEqual || !nonIndependentEqual) { | 215 bool variablesEqual = oldStyle->variablesEqual(*newStyle); |
| 216 if (!independentEqual || !nonIndependentEqual || !variablesEqual) { |
| 217 // Check if only independent inherited properties changed. |
| 216 if (nonIndependentEqual && !oldStyle->hasExplicitlyInheritedProperties()) | 218 if (nonIndependentEqual && !oldStyle->hasExplicitlyInheritedProperties()) |
| 217 return IndependentInherit; | 219 if (variablesEqual) |
| 220 return IndependentInherit; |
| 221 // Variables and possibly independent inherited properties changed. |
| 222 return IndependentInheritWithVariables; |
| 218 return Inherit; | 223 return Inherit; |
| 219 } | 224 } |
| 220 | 225 |
| 221 if (!oldStyle->loadingCustomFontsEqual(*newStyle) || | 226 if (!oldStyle->loadingCustomFontsEqual(*newStyle) || |
| 222 oldStyle->alignItems() != newStyle->alignItems() || | 227 oldStyle->alignItems() != newStyle->alignItems() || |
| 223 oldStyle->justifyItems() != newStyle->justifyItems()) | 228 oldStyle->justifyItems() != newStyle->justifyItems()) |
| 224 return Inherit; | 229 return Inherit; |
| 225 | 230 |
| 226 if (*oldStyle == *newStyle) | 231 if (*oldStyle == *newStyle) |
| 227 return diffPseudoStyles(*oldStyle, *newStyle); | 232 return diffPseudoStyles(*oldStyle, *newStyle); |
| 228 | 233 |
| 229 if (oldStyle->hasExplicitlyInheritedProperties()) | 234 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 230 return Inherit; | 235 return Inherit; |
| 231 | 236 |
| 232 return NoInherit; | 237 return NoInherit; |
| 233 } | 238 } |
| 234 | 239 |
| 235 // TODO(sashab): Generate this function. | 240 // TODO(sashab): Generate this function. |
| 236 void ComputedStyle::propagateIndependentInheritedProperties( | 241 void ComputedStyle::propagateIndependentInheritedProperties( |
| 237 const ComputedStyle& parentStyle) { | 242 const ComputedStyle& parentStyle) { |
| 238 if (m_nonInheritedData.m_isPointerEventsInherited) | 243 if (m_nonInheritedData.m_isPointerEventsInherited) |
| 239 setPointerEvents(parentStyle.pointerEvents()); | 244 setPointerEvents(parentStyle.pointerEvents()); |
| 240 if (m_nonInheritedData.m_isVisibilityInherited) | 245 if (m_nonInheritedData.m_isVisibilityInherited) |
| 241 setVisibility(parentStyle.visibility()); | 246 setVisibility(parentStyle.visibility()); |
| 247 |
| 248 // Variables. |
| 249 if (parentStyle.variables() != variables()) { |
| 250 for (const auto& variable : *parentStyle.variables()) { |
| 251 if (inheritsVariableDefinitionFromParent(variable.key) && |
| 252 *variable.value != *variables()->getVariable(variable.key)) { |
| 253 setVariable(variable.key, variable.value); |
| 254 } |
| 255 } |
| 256 } |
| 242 } | 257 } |
| 243 | 258 |
| 244 StyleSelfAlignmentData resolvedSelfAlignment( | 259 StyleSelfAlignmentData resolvedSelfAlignment( |
| 245 const StyleSelfAlignmentData& value, | 260 const StyleSelfAlignmentData& value, |
| 246 ItemPosition normalValueBehavior) { | 261 ItemPosition normalValueBehavior) { |
| 247 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' | 262 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' |
| 248 // flag to not just mean 'auto' prior to running the StyleAdjuster but also | 263 // flag to not just mean 'auto' prior to running the StyleAdjuster but also |
| 249 // mean 'normal' after running it. | 264 // mean 'normal' after running it. |
| 250 if (value.position() == ItemPositionNormal || | 265 if (value.position() == ItemPositionNormal || |
| 251 value.position() == ItemPositionAuto) | 266 value.position() == ItemPositionAuto) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 526 |
| 512 bool ComputedStyle::nonIndependentInheritedEqual( | 527 bool ComputedStyle::nonIndependentInheritedEqual( |
| 513 const ComputedStyle& other) const { | 528 const ComputedStyle& other) const { |
| 514 return ComputedStyleBase::nonIndependentInheritedEqual(other) && | 529 return ComputedStyleBase::nonIndependentInheritedEqual(other) && |
| 515 m_inheritedData.compareEqualNonIndependent(other.m_inheritedData) && | 530 m_inheritedData.compareEqualNonIndependent(other.m_inheritedData) && |
| 516 m_styleInheritedData == other.m_styleInheritedData && | 531 m_styleInheritedData == other.m_styleInheritedData && |
| 517 m_svgStyle->inheritedEqual(*other.m_svgStyle) && | 532 m_svgStyle->inheritedEqual(*other.m_svgStyle) && |
| 518 m_rareInheritedData == other.m_rareInheritedData; | 533 m_rareInheritedData == other.m_rareInheritedData; |
| 519 } | 534 } |
| 520 | 535 |
| 536 bool ComputedStyle::variablesEqual(const ComputedStyle& other) const { |
| 537 return m_rareInheritedData->compareEqualVariables(*other.m_rareInheritedData); |
| 538 } |
| 539 |
| 521 bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const { | 540 bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const { |
| 522 return font().loadingCustomFonts() == other.font().loadingCustomFonts(); | 541 return font().loadingCustomFonts() == other.font().loadingCustomFonts(); |
| 523 } | 542 } |
| 524 | 543 |
| 525 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const { | 544 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const { |
| 526 // compare everything except the pseudoStyle pointer | 545 // compare everything except the pseudoStyle pointer |
| 527 return ComputedStyleBase::nonInheritedEqual(other) && | 546 return ComputedStyleBase::nonInheritedEqual(other) && |
| 528 m_nonInheritedData == other.m_nonInheritedData && | 547 m_nonInheritedData == other.m_nonInheritedData && |
| 529 m_box == other.m_box && m_visual == other.m_visual && | 548 m_box == other.m_box && m_visual == other.m_visual && |
| 530 m_background == other.m_background && m_surround == other.m_surround && | 549 m_background == other.m_background && m_surround == other.m_surround && |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2417 if (value < 0) | 2436 if (value < 0) |
| 2418 fvalue -= 0.5f; | 2437 fvalue -= 0.5f; |
| 2419 else | 2438 else |
| 2420 fvalue += 0.5f; | 2439 fvalue += 0.5f; |
| 2421 } | 2440 } |
| 2422 | 2441 |
| 2423 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2442 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2424 } | 2443 } |
| 2425 | 2444 |
| 2426 } // namespace blink | 2445 } // namespace blink |
| OLD | NEW |