| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 svg_style_.Access()->InheritFrom(inherit_parent.svg_style_.Get()); | 327 svg_style_.Access()->InheritFrom(inherit_parent.svg_style_.Get()); |
| 328 | 328 |
| 329 if (is_at_shadow_boundary == kAtShadowBoundary) { | 329 if (is_at_shadow_boundary == kAtShadowBoundary) { |
| 330 // Even if surrounding content is user-editable, shadow DOM should act as a | 330 // Even if surrounding content is user-editable, shadow DOM should act as a |
| 331 // single unit, and not necessarily be editable | 331 // single unit, and not necessarily be editable |
| 332 SetUserModify(current_user_modify); | 332 SetUserModify(current_user_modify); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 void ComputedStyle::CopyNonInheritedFromCached(const ComputedStyle& other) { | 336 void ComputedStyle::CopyNonInheritedFromCached(const ComputedStyle& other) { |
| 337 DCHECK(MatchedPropertiesCache::IsStyleCacheable(other)); |
| 338 |
| 337 ComputedStyleBase::CopyNonInheritedFromCached(other); | 339 ComputedStyleBase::CopyNonInheritedFromCached(other); |
| 338 rare_non_inherited_data_ = other.rare_non_inherited_data_; | 340 rare_non_inherited_data_ = other.rare_non_inherited_data_; |
| 339 | 341 |
| 340 // The flags are copied one-by-one because they contain | 342 // The flags are copied one-by-one because they contain |
| 341 // bunch of stuff other than real style data. | 343 // bunch of stuff other than real style data. |
| 342 // See comments for each skipped flag below. | 344 // See comments for each skipped flag below. |
| 343 | 345 |
| 344 // These are not generated in ComputedStyleBase | 346 // These are not generated in ComputedStyleBase |
| 345 SetHasViewportUnits(other.HasViewportUnits()); | 347 SetHasViewportUnits(other.HasViewportUnits()); |
| 346 SetHasRemUnitsInternal(other.HasRemUnits()); | 348 SetHasRemUnitsInternal(other.HasRemUnits()); |
| 347 | 349 |
| 348 // Correctly set during selector matching: | 350 // Correctly set during selector matching: |
| 349 // m_styleType | 351 // m_styleType |
| 350 // m_pseudoBits | 352 // m_pseudoBits |
| 351 | 353 |
| 352 // Set correctly while computing style for children: | 354 // Set correctly while computing style for children: |
| 353 // m_explicitInheritance | 355 // m_explicitInheritance |
| 354 | 356 |
| 355 // unique() styles are not cacheable. | |
| 356 DCHECK(!other.Unique()); | |
| 357 | |
| 358 // styles with non inherited properties that reference variables are not | |
| 359 // cacheable. | |
| 360 DCHECK(!other.HasVariableReferenceFromNonInheritedProperty()); | |
| 361 | |
| 362 // The following flags are set during matching before we decide that we get a | 357 // The following flags are set during matching before we decide that we get a |
| 363 // match in the MatchedPropertiesCache which in turn calls this method. The | 358 // match in the MatchedPropertiesCache which in turn calls this method. The |
| 364 // reason why we don't copy these flags is that they're already correctly set | 359 // reason why we don't copy these flags is that they're already correctly set |
| 365 // and that they may differ between elements which have the same set of | 360 // and that they may differ between elements which have the same set of |
| 366 // matched properties. For instance, given the rule: | 361 // matched properties. For instance, given the rule: |
| 367 // | 362 // |
| 368 // :-webkit-any(:hover, :focus) { background-color: green }" | 363 // :-webkit-any(:hover, :focus) { background-color: green }" |
| 369 // | 364 // |
| 370 // A hovered element, and a focused element may use the same cached matched | 365 // A hovered element, and a focused element may use the same cached matched |
| 371 // properties here, but the affectedBy flags will be set differently based on | 366 // properties here, but the affectedBy flags will be set differently based on |
| 372 // the matching order of the :-webkit-any components. | 367 // the matching order of the :-webkit-any components. |
| 373 // | 368 // |
| 374 // m_emptyState | 369 // m_emptyState |
| 375 // m_affectedByFocus | 370 // m_affectedByFocus |
| 376 // m_affectedByHover | 371 // m_affectedByHover |
| 377 // m_affectedByActive | 372 // m_affectedByActive |
| 378 // m_affectedByDrag | 373 // m_affectedByDrag |
| 379 // m_isLink | 374 // m_isLink |
| 380 | 375 |
| 381 if (svg_style_ != other.svg_style_) | 376 if (svg_style_ != other.svg_style_) |
| 382 svg_style_.Access()->CopyNonInheritedFromCached(other.svg_style_.Get()); | 377 svg_style_.Access()->CopyNonInheritedFromCached(other.svg_style_.Get()); |
| 383 DCHECK_EQ(Zoom(), InitialZoom()); | |
| 384 } | 378 } |
| 385 | 379 |
| 386 bool ComputedStyle::operator==(const ComputedStyle& o) const { | 380 bool ComputedStyle::operator==(const ComputedStyle& o) const { |
| 387 return InheritedEqual(o) && NonInheritedEqual(o); | 381 return InheritedEqual(o) && NonInheritedEqual(o); |
| 388 } | 382 } |
| 389 | 383 |
| 390 bool ComputedStyle::IsStyleAvailable() const { | 384 bool ComputedStyle::IsStyleAvailable() const { |
| 391 return this != StyleResolver::StyleNotYetAvailable(); | 385 return this != StyleResolver::StyleNotYetAvailable(); |
| 392 } | 386 } |
| 393 | 387 |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 if (value < 0) | 2477 if (value < 0) |
| 2484 fvalue -= 0.5f; | 2478 fvalue -= 0.5f; |
| 2485 else | 2479 else |
| 2486 fvalue += 0.5f; | 2480 fvalue += 0.5f; |
| 2487 } | 2481 } |
| 2488 | 2482 |
| 2489 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2483 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
| 2490 } | 2484 } |
| 2491 | 2485 |
| 2492 } // namespace blink | 2486 } // namespace blink |
| OLD | NEW |