| 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
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 4 * reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 6 * |
| 6 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 9 * 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. |
| 10 * | 11 * |
| 11 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 oldStyle.getCachedPseudoStyle(pseudoId); | 188 oldStyle.getCachedPseudoStyle(pseudoId); |
| 188 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) | 189 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) |
| 189 return NoInherit; | 190 return NoInherit; |
| 190 } | 191 } |
| 191 return NoChange; | 192 return NoChange; |
| 192 } | 193 } |
| 193 | 194 |
| 194 StyleRecalcChange ComputedStyle::stylePropagationDiff( | 195 StyleRecalcChange ComputedStyle::stylePropagationDiff( |
| 195 const ComputedStyle* oldStyle, | 196 const ComputedStyle* oldStyle, |
| 196 const ComputedStyle* newStyle) { | 197 const ComputedStyle* newStyle) { |
| 197 // If the style has changed from display none or to display none, then the lay
out subtree needs to be reattached | 198 // If the style has changed from display none or to display none, then the |
| 199 // layout subtree needs to be reattached |
| 198 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) | 200 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) |
| 199 return Reattach; | 201 return Reattach; |
| 200 | 202 |
| 201 if (!oldStyle && !newStyle) | 203 if (!oldStyle && !newStyle) |
| 202 return NoChange; | 204 return NoChange; |
| 203 | 205 |
| 204 if (oldStyle->display() != newStyle->display() || | 206 if (oldStyle->display() != newStyle->display() || |
| 205 oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != | 207 oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != |
| 206 newStyle->hasPseudoStyle(PseudoIdFirstLetter) || | 208 newStyle->hasPseudoStyle(PseudoIdFirstLetter) || |
| 207 !oldStyle->contentDataEquivalent(newStyle) || | 209 !oldStyle->contentDataEquivalent(newStyle) || |
| (...skipping 27 matching lines...) Expand all Loading... |
| 235 const ComputedStyle& parentStyle) { | 237 const ComputedStyle& parentStyle) { |
| 236 if (m_nonInheritedData.m_isPointerEventsInherited) | 238 if (m_nonInheritedData.m_isPointerEventsInherited) |
| 237 setPointerEvents(parentStyle.pointerEvents()); | 239 setPointerEvents(parentStyle.pointerEvents()); |
| 238 if (m_nonInheritedData.m_isVisibilityInherited) | 240 if (m_nonInheritedData.m_isVisibilityInherited) |
| 239 setVisibility(parentStyle.visibility()); | 241 setVisibility(parentStyle.visibility()); |
| 240 } | 242 } |
| 241 | 243 |
| 242 StyleSelfAlignmentData resolvedSelfAlignment( | 244 StyleSelfAlignmentData resolvedSelfAlignment( |
| 243 const StyleSelfAlignmentData& value, | 245 const StyleSelfAlignmentData& value, |
| 244 ItemPosition normalValueBehavior) { | 246 ItemPosition normalValueBehavior) { |
| 245 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto'
flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'n
ormal' after running it. | 247 // 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 |
| 249 // mean 'normal' after running it. |
| 246 if (value.position() == ItemPositionNormal || | 250 if (value.position() == ItemPositionNormal || |
| 247 value.position() == ItemPositionAuto) | 251 value.position() == ItemPositionAuto) |
| 248 return {normalValueBehavior, OverflowAlignmentDefault}; | 252 return {normalValueBehavior, OverflowAlignmentDefault}; |
| 249 return value; | 253 return value; |
| 250 } | 254 } |
| 251 | 255 |
| 252 StyleSelfAlignmentData ComputedStyle::resolvedAlignItems( | 256 StyleSelfAlignmentData ComputedStyle::resolvedAlignItems( |
| 253 ItemPosition normalValueBehaviour) const { | 257 ItemPosition normalValueBehaviour) const { |
| 254 // We will return the behaviour of 'normal' value if needed, which is specific
of each layout model. | 258 // We will return the behaviour of 'normal' value if needed, which is specific |
| 259 // of each layout model. |
| 255 return resolvedSelfAlignment(alignItems(), normalValueBehaviour); | 260 return resolvedSelfAlignment(alignItems(), normalValueBehaviour); |
| 256 } | 261 } |
| 257 | 262 |
| 258 StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf( | 263 StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf( |
| 259 ItemPosition normalValueBehaviour, | 264 ItemPosition normalValueBehaviour, |
| 260 const ComputedStyle* parentStyle) const { | 265 const ComputedStyle* parentStyle) const { |
| 261 // We will return the behaviour of 'normal' value if needed, which is specific
of each layout model. | 266 // We will return the behaviour of 'normal' value if needed, which is specific |
| 267 // of each layout model. |
| 262 if (!parentStyle || alignSelfPosition() != ItemPositionAuto) | 268 if (!parentStyle || alignSelfPosition() != ItemPositionAuto) |
| 263 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); | 269 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); |
| 264 | 270 |
| 265 // We shouldn't need to resolve any 'auto' value in post-adjusment ComputedSty
le, but some layout models | 271 // We shouldn't need to resolve any 'auto' value in post-adjusment |
| 266 // can generate anonymous boxes that may need 'auto' value resolution during l
ayout. | 272 // ComputedStyle, but some layout models can generate anonymous boxes that may |
| 273 // need 'auto' value resolution during layout. |
| 267 // The 'auto' keyword computes to the parent's align-items computed value. | 274 // The 'auto' keyword computes to the parent's align-items computed value. |
| 268 return parentStyle->resolvedAlignItems(normalValueBehaviour); | 275 return parentStyle->resolvedAlignItems(normalValueBehaviour); |
| 269 } | 276 } |
| 270 | 277 |
| 271 StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems( | 278 StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems( |
| 272 ItemPosition normalValueBehaviour) const { | 279 ItemPosition normalValueBehaviour) const { |
| 273 // We will return the behaviour of 'normal' value if needed, which is specific
of each layout model. | 280 // We will return the behaviour of 'normal' value if needed, which is specific |
| 281 // of each layout model. |
| 274 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); | 282 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); |
| 275 } | 283 } |
| 276 | 284 |
| 277 StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf( | 285 StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf( |
| 278 ItemPosition normalValueBehaviour, | 286 ItemPosition normalValueBehaviour, |
| 279 const ComputedStyle* parentStyle) const { | 287 const ComputedStyle* parentStyle) const { |
| 280 // We will return the behaviour of 'normal' value if needed, which is specific
of each layout model. | 288 // We will return the behaviour of 'normal' value if needed, which is specific |
| 289 // of each layout model. |
| 281 if (!parentStyle || justifySelfPosition() != ItemPositionAuto) | 290 if (!parentStyle || justifySelfPosition() != ItemPositionAuto) |
| 282 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); | 291 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); |
| 283 | 292 |
| 284 // We shouldn't need to resolve any 'auto' value in post-adjusment ComputedSty
le, but some layout models | 293 // We shouldn't need to resolve any 'auto' value in post-adjusment |
| 285 // can generate anonymous boxes that may need 'auto' value resolution during l
ayout. | 294 // ComputedStyle, but some layout models can generate anonymous boxes that may |
| 295 // need 'auto' value resolution during layout. |
| 286 // The auto keyword computes to the parent's justify-items computed value. | 296 // The auto keyword computes to the parent's justify-items computed value. |
| 287 return parentStyle->resolvedJustifyItems(normalValueBehaviour); | 297 return parentStyle->resolvedJustifyItems(normalValueBehaviour); |
| 288 } | 298 } |
| 289 | 299 |
| 290 static inline ContentPosition resolvedContentAlignmentPosition( | 300 static inline ContentPosition resolvedContentAlignmentPosition( |
| 291 const StyleContentAlignmentData& value, | 301 const StyleContentAlignmentData& value, |
| 292 const StyleContentAlignmentData& normalValueBehavior) { | 302 const StyleContentAlignmentData& normalValueBehavior) { |
| 293 return (value.position() == ContentPositionNormal && | 303 return (value.position() == ContentPositionNormal && |
| 294 value.distribution() == ContentDistributionDefault) | 304 value.distribution() == ContentDistributionDefault) |
| 295 ? normalValueBehavior.position() | 305 ? normalValueBehavior.position() |
| (...skipping 29 matching lines...) Expand all Loading... |
| 325 ContentDistributionType ComputedStyle::resolvedAlignContentDistribution( | 335 ContentDistributionType ComputedStyle::resolvedAlignContentDistribution( |
| 326 const StyleContentAlignmentData& normalValueBehavior) const { | 336 const StyleContentAlignmentData& normalValueBehavior) const { |
| 327 return resolvedContentAlignmentDistribution(alignContent(), | 337 return resolvedContentAlignmentDistribution(alignContent(), |
| 328 normalValueBehavior); | 338 normalValueBehavior); |
| 329 } | 339 } |
| 330 | 340 |
| 331 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, | 341 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, |
| 332 IsAtShadowBoundary isAtShadowBoundary) { | 342 IsAtShadowBoundary isAtShadowBoundary) { |
| 333 ComputedStyleBase::inheritFrom(inheritParent, isAtShadowBoundary); | 343 ComputedStyleBase::inheritFrom(inheritParent, isAtShadowBoundary); |
| 334 if (isAtShadowBoundary == AtShadowBoundary) { | 344 if (isAtShadowBoundary == AtShadowBoundary) { |
| 335 // Even if surrounding content is user-editable, shadow DOM should act as a
single unit, and not necessarily be editable | 345 // Even if surrounding content is user-editable, shadow DOM should act as a |
| 346 // single unit, and not necessarily be editable |
| 336 EUserModify currentUserModify = userModify(); | 347 EUserModify currentUserModify = userModify(); |
| 337 m_rareInheritedData = inheritParent.m_rareInheritedData; | 348 m_rareInheritedData = inheritParent.m_rareInheritedData; |
| 338 setUserModify(currentUserModify); | 349 setUserModify(currentUserModify); |
| 339 } else { | 350 } else { |
| 340 m_rareInheritedData = inheritParent.m_rareInheritedData; | 351 m_rareInheritedData = inheritParent.m_rareInheritedData; |
| 341 } | 352 } |
| 342 m_styleInheritedData = inheritParent.m_styleInheritedData; | 353 m_styleInheritedData = inheritParent.m_styleInheritedData; |
| 343 m_inheritedData = inheritParent.m_inheritedData; | 354 m_inheritedData = inheritParent.m_inheritedData; |
| 344 if (m_svgStyle != inheritParent.m_svgStyle) | 355 if (m_svgStyle != inheritParent.m_svgStyle) |
| 345 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); | 356 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); |
| 346 } | 357 } |
| 347 | 358 |
| 348 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) { | 359 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) { |
| 349 ComputedStyleBase::copyNonInheritedFromCached(other); | 360 ComputedStyleBase::copyNonInheritedFromCached(other); |
| 350 m_box = other.m_box; | 361 m_box = other.m_box; |
| 351 m_visual = other.m_visual; | 362 m_visual = other.m_visual; |
| 352 m_background = other.m_background; | 363 m_background = other.m_background; |
| 353 m_surround = other.m_surround; | 364 m_surround = other.m_surround; |
| 354 m_rareNonInheritedData = other.m_rareNonInheritedData; | 365 m_rareNonInheritedData = other.m_rareNonInheritedData; |
| 355 | 366 |
| 356 // The flags are copied one-by-one because m_nonInheritedData.m_contains a bun
ch of stuff other than real style data. | 367 // The flags are copied one-by-one because m_nonInheritedData.m_contains a |
| 368 // bunch of stuff other than real style data. |
| 357 // See comments for each skipped flag below. | 369 // See comments for each skipped flag below. |
| 358 m_nonInheritedData.m_effectiveDisplay = | 370 m_nonInheritedData.m_effectiveDisplay = |
| 359 other.m_nonInheritedData.m_effectiveDisplay; | 371 other.m_nonInheritedData.m_effectiveDisplay; |
| 360 m_nonInheritedData.m_originalDisplay = | 372 m_nonInheritedData.m_originalDisplay = |
| 361 other.m_nonInheritedData.m_originalDisplay; | 373 other.m_nonInheritedData.m_originalDisplay; |
| 362 m_nonInheritedData.m_overflowAnchor = | 374 m_nonInheritedData.m_overflowAnchor = |
| 363 other.m_nonInheritedData.m_overflowAnchor; | 375 other.m_nonInheritedData.m_overflowAnchor; |
| 364 m_nonInheritedData.m_overflowX = other.m_nonInheritedData.m_overflowX; | 376 m_nonInheritedData.m_overflowX = other.m_nonInheritedData.m_overflowX; |
| 365 m_nonInheritedData.m_overflowY = other.m_nonInheritedData.m_overflowY; | 377 m_nonInheritedData.m_overflowY = other.m_nonInheritedData.m_overflowY; |
| 366 m_nonInheritedData.m_verticalAlign = other.m_nonInheritedData.m_verticalAlign; | 378 m_nonInheritedData.m_verticalAlign = other.m_nonInheritedData.m_verticalAlign; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 385 // unique() styles are not cacheable. | 397 // unique() styles are not cacheable. |
| 386 DCHECK(!other.m_nonInheritedData.m_unique); | 398 DCHECK(!other.m_nonInheritedData.m_unique); |
| 387 | 399 |
| 388 // styles with non inherited properties that reference variables are not | 400 // styles with non inherited properties that reference variables are not |
| 389 // cacheable. | 401 // cacheable. |
| 390 DCHECK(!other.m_nonInheritedData.m_variableReference); | 402 DCHECK(!other.m_nonInheritedData.m_variableReference); |
| 391 | 403 |
| 392 // The following flags are set during matching before we decide that we get a | 404 // The following flags are set during matching before we decide that we get a |
| 393 // match in the MatchedPropertiesCache which in turn calls this method. The | 405 // match in the MatchedPropertiesCache which in turn calls this method. The |
| 394 // reason why we don't copy these flags is that they're already correctly set | 406 // reason why we don't copy these flags is that they're already correctly set |
| 395 // and that they may differ between elements which have the same set of matche
d | 407 // and that they may differ between elements which have the same set of |
| 396 // properties. For instance, given the rule: | 408 // matched properties. For instance, given the rule: |
| 397 // | 409 // |
| 398 // :-webkit-any(:hover, :focus) { background-color: green }" | 410 // :-webkit-any(:hover, :focus) { background-color: green }" |
| 399 // | 411 // |
| 400 // A hovered element, and a focused element may use the same cached matched | 412 // A hovered element, and a focused element may use the same cached matched |
| 401 // properties here, but the affectedBy flags will be set differently based on | 413 // properties here, but the affectedBy flags will be set differently based on |
| 402 // the matching order of the :-webkit-any components. | 414 // the matching order of the :-webkit-any components. |
| 403 // | 415 // |
| 404 // m_nonInheritedData.m_emptyState | 416 // m_nonInheritedData.m_emptyState |
| 405 // m_nonInheritedData.m_affectedByFocus | 417 // m_nonInheritedData.m_affectedByFocus |
| 406 // m_nonInheritedData.m_affectedByHover | 418 // m_nonInheritedData.m_affectedByHover |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? | 537 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? |
| 526 return ComputedStyleBase::inheritedEqual(other) && | 538 return ComputedStyleBase::inheritedEqual(other) && |
| 527 m_inheritedData == other.m_inheritedData && | 539 m_inheritedData == other.m_inheritedData && |
| 528 m_styleInheritedData.get() == other.m_styleInheritedData.get() && | 540 m_styleInheritedData.get() == other.m_styleInheritedData.get() && |
| 529 m_svgStyle.get() == other.m_svgStyle.get() && | 541 m_svgStyle.get() == other.m_svgStyle.get() && |
| 530 m_rareInheritedData.get() == other.m_rareInheritedData.get(); | 542 m_rareInheritedData.get() == other.m_rareInheritedData.get(); |
| 531 } | 543 } |
| 532 | 544 |
| 533 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, | 545 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, |
| 534 const ComputedStyle& b) { | 546 const ComputedStyle& b) { |
| 535 // If top or bottom become auto/non-auto then it means we either have to solve
height based | 547 // If top or bottom become auto/non-auto then it means we either have to solve |
| 536 // on the content or stop doing so (http://www.w3.org/TR/CSS2/visudet.html#abs
-non-replaced-height) | 548 // height based on the content or stop doing so |
| 549 // (http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height) |
| 537 // - either way requires a layout. | 550 // - either way requires a layout. |
| 538 return a.logicalTop().isAuto() != b.logicalTop().isAuto() || | 551 return a.logicalTop().isAuto() != b.logicalTop().isAuto() || |
| 539 a.logicalBottom().isAuto() != b.logicalBottom().isAuto(); | 552 a.logicalBottom().isAuto() != b.logicalBottom().isAuto(); |
| 540 } | 553 } |
| 541 | 554 |
| 542 StyleDifference ComputedStyle::visualInvalidationDiff( | 555 StyleDifference ComputedStyle::visualInvalidationDiff( |
| 543 const ComputedStyle& other) const { | 556 const ComputedStyle& other) const { |
| 544 // Note, we use .get() on each DataRef below because DataRef::operator== will
do a deep | 557 // Note, we use .get() on each DataRef below because DataRef::operator== will |
| 545 // compare, which is duplicate work when we're going to compare each property
inside | 558 // do a deep compare, which is duplicate work when we're going to compare each |
| 546 // this function anyway. | 559 // property inside this function anyway. |
| 547 | 560 |
| 548 StyleDifference diff; | 561 StyleDifference diff; |
| 549 if (m_svgStyle.get() != other.m_svgStyle.get()) | 562 if (m_svgStyle.get() != other.m_svgStyle.get()) |
| 550 diff = m_svgStyle->diff(other.m_svgStyle.get()); | 563 diff = m_svgStyle->diff(other.m_svgStyle.get()); |
| 551 | 564 |
| 552 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && | 565 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && |
| 553 diffNeedsFullLayoutAndPaintInvalidation(other)) { | 566 diffNeedsFullLayoutAndPaintInvalidation(other)) { |
| 554 diff.setNeedsFullLayout(); | 567 diff.setNeedsFullLayout(); |
| 555 diff.setNeedsPaintInvalidationObject(); | 568 diff.setNeedsPaintInvalidationObject(); |
| 556 } | 569 } |
| 557 | 570 |
| 558 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) | 571 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) |
| 559 diff.setNeedsFullLayout(); | 572 diff.setNeedsFullLayout(); |
| 560 | 573 |
| 561 if (!diff.needsFullLayout() && | 574 if (!diff.needsFullLayout() && |
| 562 m_surround->margin != other.m_surround->margin) { | 575 m_surround->margin != other.m_surround->margin) { |
| 563 // Relative-positioned elements collapse their margins so need a full layout
. | 576 // Relative-positioned elements collapse their margins so need a full |
| 577 // layout. |
| 564 if (hasOutOfFlowPosition()) | 578 if (hasOutOfFlowPosition()) |
| 565 diff.setNeedsPositionedMovementLayout(); | 579 diff.setNeedsPositionedMovementLayout(); |
| 566 else | 580 else |
| 567 diff.setNeedsFullLayout(); | 581 diff.setNeedsFullLayout(); |
| 568 } | 582 } |
| 569 | 583 |
| 570 if (!diff.needsFullLayout() && position() != StaticPosition && | 584 if (!diff.needsFullLayout() && position() != StaticPosition && |
| 571 m_surround->offset != other.m_surround->offset) { | 585 m_surround->offset != other.m_surround->offset) { |
| 572 // Optimize for the case where a positioned layer is moving but not changing
size. | 586 // Optimize for the case where a positioned layer is moving but not changing |
| 587 // size. |
| 573 if (dependenceOnContentHeightHasChanged(*this, other)) | 588 if (dependenceOnContentHeightHasChanged(*this, other)) |
| 574 diff.setNeedsFullLayout(); | 589 diff.setNeedsFullLayout(); |
| 575 else | 590 else |
| 576 diff.setNeedsPositionedMovementLayout(); | 591 diff.setNeedsPositionedMovementLayout(); |
| 577 } | 592 } |
| 578 | 593 |
| 579 if (diffNeedsPaintInvalidationSubtree(other)) | 594 if (diffNeedsPaintInvalidationSubtree(other)) |
| 580 diff.setNeedsPaintInvalidationSubtree(); | 595 diff.setNeedsPaintInvalidationSubtree(); |
| 581 else if (diffNeedsPaintInvalidationObject(other)) | 596 else if (diffNeedsPaintInvalidationObject(other)) |
| 582 diff.setNeedsPaintInvalidationObject(); | 597 diff.setNeedsPaintInvalidationObject(); |
| 583 | 598 |
| 584 updatePropertySpecificDifferences(other, diff); | 599 updatePropertySpecificDifferences(other, diff); |
| 585 | 600 |
| 586 // TODO(skobes): Refine the criteria for ScrollAnchor-disabling properties. | 601 // TODO(skobes): Refine the criteria for ScrollAnchor-disabling properties. |
| 587 // Some things set needsLayout but shouldn't disable scroll anchoring. | 602 // Some things set needsLayout but shouldn't disable scroll anchoring. |
| 588 if (diff.needsLayout() || diff.transformChanged()) | 603 if (diff.needsLayout() || diff.transformChanged()) |
| 589 diff.setScrollAnchorDisablingPropertyChanged(); | 604 diff.setScrollAnchorDisablingPropertyChanged(); |
| 590 | 605 |
| 591 // Cursors are not checked, since they will be set appropriately in response t
o mouse events, | 606 // Cursors are not checked, since they will be set appropriately in response |
| 592 // so they don't need to cause any paint invalidation or layout. | 607 // to mouse events, so they don't need to cause any paint invalidation or |
| 608 // layout. |
| 593 | 609 |
| 594 // Animations don't need to be checked either. We always set the new style on
the layoutObject, so we will get a chance to fire off | 610 // Animations don't need to be checked either. We always set the new style on |
| 595 // the resulting transition properly. | 611 // the layoutObject, so we will get a chance to fire off the resulting |
| 612 // transition properly. |
| 596 | 613 |
| 597 return diff; | 614 return diff; |
| 598 } | 615 } |
| 599 | 616 |
| 600 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation( | 617 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation( |
| 601 const ComputedStyle& other) const { | 618 const ComputedStyle& other) const { |
| 602 // FIXME: Not all cases in this method need both full layout and paint invalid
ation. | 619 // FIXME: Not all cases in this method need both full layout and paint |
| 620 // invalidation. |
| 603 // Should move cases into diffNeedsFullLayout() if | 621 // Should move cases into diffNeedsFullLayout() if |
| 604 // - don't need paint invalidation at all; | 622 // - don't need paint invalidation at all; |
| 605 // - or the layoutObject knows how to exactly invalidate paints caused by the
layout change | 623 // - or the layoutObject knows how to exactly invalidate paints caused by the |
| 606 // instead of forced full paint invalidation. | 624 // layout change instead of forced full paint invalidation. |
| 607 | 625 |
| 608 if (m_surround.get() != other.m_surround.get()) { | 626 if (m_surround.get() != other.m_surround.get()) { |
| 609 // If our border widths change, then we need to layout. Other changes to bor
ders only necessitate a paint invalidation. | 627 // If our border widths change, then we need to layout. Other changes to |
| 628 // borders only necessitate a paint invalidation. |
| 610 if (borderLeftWidth() != other.borderLeftWidth() || | 629 if (borderLeftWidth() != other.borderLeftWidth() || |
| 611 borderTopWidth() != other.borderTopWidth() || | 630 borderTopWidth() != other.borderTopWidth() || |
| 612 borderBottomWidth() != other.borderBottomWidth() || | 631 borderBottomWidth() != other.borderBottomWidth() || |
| 613 borderRightWidth() != other.borderRightWidth()) | 632 borderRightWidth() != other.borderRightWidth()) |
| 614 return true; | 633 return true; |
| 615 } | 634 } |
| 616 | 635 |
| 617 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { | 636 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
| 618 if (m_rareNonInheritedData->m_appearance != | 637 if (m_rareNonInheritedData->m_appearance != |
| 619 other.m_rareNonInheritedData->m_appearance || | 638 other.m_rareNonInheritedData->m_appearance || |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 *m_rareNonInheritedData->m_flexibleBox.get() != | 675 *m_rareNonInheritedData->m_flexibleBox.get() != |
| 657 *other.m_rareNonInheritedData->m_flexibleBox.get()) | 676 *other.m_rareNonInheritedData->m_flexibleBox.get()) |
| 658 return true; | 677 return true; |
| 659 | 678 |
| 660 if (m_rareNonInheritedData->m_multiCol.get() != | 679 if (m_rareNonInheritedData->m_multiCol.get() != |
| 661 other.m_rareNonInheritedData->m_multiCol.get() && | 680 other.m_rareNonInheritedData->m_multiCol.get() && |
| 662 *m_rareNonInheritedData->m_multiCol.get() != | 681 *m_rareNonInheritedData->m_multiCol.get() != |
| 663 *other.m_rareNonInheritedData->m_multiCol.get()) | 682 *other.m_rareNonInheritedData->m_multiCol.get()) |
| 664 return true; | 683 return true; |
| 665 | 684 |
| 666 // If the counter directives change, trigger a relayout to re-calculate coun
ter values and rebuild the counter node tree. | 685 // If the counter directives change, trigger a relayout to re-calculate |
| 686 // counter values and rebuild the counter node tree. |
| 667 const CounterDirectiveMap* mapA = | 687 const CounterDirectiveMap* mapA = |
| 668 m_rareNonInheritedData->m_counterDirectives.get(); | 688 m_rareNonInheritedData->m_counterDirectives.get(); |
| 669 const CounterDirectiveMap* mapB = | 689 const CounterDirectiveMap* mapB = |
| 670 other.m_rareNonInheritedData->m_counterDirectives.get(); | 690 other.m_rareNonInheritedData->m_counterDirectives.get(); |
| 671 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) | 691 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) |
| 672 return true; | 692 return true; |
| 673 | 693 |
| 674 // We only need do layout for opacity changes if adding or losing opacity co
uld trigger a change | 694 // We only need do layout for opacity changes if adding or losing opacity |
| 695 // could trigger a change |
| 675 // in us being a stacking context. | 696 // in us being a stacking context. |
| 676 if (isStackingContext() != other.isStackingContext() && | 697 if (isStackingContext() != other.isStackingContext() && |
| 677 m_rareNonInheritedData->hasOpacity() != | 698 m_rareNonInheritedData->hasOpacity() != |
| 678 other.m_rareNonInheritedData->hasOpacity()) { | 699 other.m_rareNonInheritedData->hasOpacity()) { |
| 679 // FIXME: We would like to use SimplifiedLayout here, but we can't quite d
o that yet. | 700 // FIXME: We would like to use SimplifiedLayout here, but we can't quite |
| 680 // We need to make sure SimplifiedLayout can operate correctly on LayoutIn
lines (we will need | 701 // do that yet. We need to make sure SimplifiedLayout can operate |
| 681 // to add a selfNeedsSimplifiedLayout bit in order to not get confused and
taint every line). | 702 // correctly on LayoutInlines (we will need to add a |
| 682 // In addition we need to solve the floating object issue when layers come
and go. Right now | 703 // selfNeedsSimplifiedLayout bit in order to not get confused and taint |
| 683 // a full layout is necessary to keep floating object lists sane. | 704 // every line). In addition we need to solve the floating object issue |
| 705 // when layers come and go. Right now a full layout is necessary to keep |
| 706 // floating object lists sane. |
| 684 return true; | 707 return true; |
| 685 } | 708 } |
| 686 } | 709 } |
| 687 | 710 |
| 688 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { | 711 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { |
| 689 if (m_rareInheritedData->highlight != | 712 if (m_rareInheritedData->highlight != |
| 690 other.m_rareInheritedData->highlight || | 713 other.m_rareInheritedData->highlight || |
| 691 m_rareInheritedData->indent != other.m_rareInheritedData->indent || | 714 m_rareInheritedData->indent != other.m_rareInheritedData->indent || |
| 692 m_rareInheritedData->m_textAlignLast != | 715 m_rareInheritedData->m_textAlignLast != |
| 693 other.m_rareInheritedData->m_textAlignLast || | 716 other.m_rareInheritedData->m_textAlignLast || |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 813 |
| 791 if (isDisplayTableType(display())) { | 814 if (isDisplayTableType(display())) { |
| 792 if (m_inheritedData.m_borderCollapse != | 815 if (m_inheritedData.m_borderCollapse != |
| 793 other.m_inheritedData.m_borderCollapse || | 816 other.m_inheritedData.m_borderCollapse || |
| 794 m_inheritedData.m_emptyCells != other.m_inheritedData.m_emptyCells || | 817 m_inheritedData.m_emptyCells != other.m_inheritedData.m_emptyCells || |
| 795 m_inheritedData.m_captionSide != other.m_inheritedData.m_captionSide || | 818 m_inheritedData.m_captionSide != other.m_inheritedData.m_captionSide || |
| 796 m_nonInheritedData.m_tableLayout != | 819 m_nonInheritedData.m_tableLayout != |
| 797 other.m_nonInheritedData.m_tableLayout) | 820 other.m_nonInheritedData.m_tableLayout) |
| 798 return true; | 821 return true; |
| 799 | 822 |
| 800 // In the collapsing border model, 'hidden' suppresses other borders, while
'none' | 823 // In the collapsing border model, 'hidden' suppresses other borders, while |
| 801 // does not, so these style differences can be width differences. | 824 // 'none' does not, so these style differences can be width differences. |
| 802 if (m_inheritedData.m_borderCollapse && | 825 if (m_inheritedData.m_borderCollapse && |
| 803 ((borderTopStyle() == BorderStyleHidden && | 826 ((borderTopStyle() == BorderStyleHidden && |
| 804 other.borderTopStyle() == BorderStyleNone) || | 827 other.borderTopStyle() == BorderStyleNone) || |
| 805 (borderTopStyle() == BorderStyleNone && | 828 (borderTopStyle() == BorderStyleNone && |
| 806 other.borderTopStyle() == BorderStyleHidden) || | 829 other.borderTopStyle() == BorderStyleHidden) || |
| 807 (borderBottomStyle() == BorderStyleHidden && | 830 (borderBottomStyle() == BorderStyleHidden && |
| 808 other.borderBottomStyle() == BorderStyleNone) || | 831 other.borderBottomStyle() == BorderStyleNone) || |
| 809 (borderBottomStyle() == BorderStyleNone && | 832 (borderBottomStyle() == BorderStyleNone && |
| 810 other.borderBottomStyle() == BorderStyleHidden) || | 833 other.borderBottomStyle() == BorderStyleHidden) || |
| 811 (borderLeftStyle() == BorderStyleHidden && | 834 (borderLeftStyle() == BorderStyleHidden && |
| (...skipping 14 matching lines...) Expand all Loading... |
| 826 } | 849 } |
| 827 | 850 |
| 828 if ((visibility() == EVisibility::Collapse) != | 851 if ((visibility() == EVisibility::Collapse) != |
| 829 (other.visibility() == EVisibility::Collapse)) | 852 (other.visibility() == EVisibility::Collapse)) |
| 830 return true; | 853 return true; |
| 831 | 854 |
| 832 if (hasPseudoStyle(PseudoIdScrollbar) != | 855 if (hasPseudoStyle(PseudoIdScrollbar) != |
| 833 other.hasPseudoStyle(PseudoIdScrollbar)) | 856 other.hasPseudoStyle(PseudoIdScrollbar)) |
| 834 return true; | 857 return true; |
| 835 | 858 |
| 836 // Movement of non-static-positioned object is special cased in ComputedStyle:
:visualInvalidationDiff(). | 859 // Movement of non-static-positioned object is special cased in |
| 860 // ComputedStyle::visualInvalidationDiff(). |
| 837 | 861 |
| 838 return false; | 862 return false; |
| 839 } | 863 } |
| 840 | 864 |
| 841 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const { | 865 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const { |
| 842 if (m_box.get() != other.m_box.get()) { | 866 if (m_box.get() != other.m_box.get()) { |
| 843 if (m_box->width() != other.m_box->width() || | 867 if (m_box->width() != other.m_box->width() || |
| 844 m_box->minWidth() != other.m_box->minWidth() || | 868 m_box->minWidth() != other.m_box->minWidth() || |
| 845 m_box->maxWidth() != other.m_box->maxWidth() || | 869 m_box->maxWidth() != other.m_box->maxWidth() || |
| 846 m_box->height() != other.m_box->height() || | 870 m_box->height() != other.m_box->height() || |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 return false; | 1233 return false; |
| 1210 } | 1234 } |
| 1211 | 1235 |
| 1212 bool ComputedStyle::requireTransformOrigin( | 1236 bool ComputedStyle::requireTransformOrigin( |
| 1213 ApplyTransformOrigin applyOrigin, | 1237 ApplyTransformOrigin applyOrigin, |
| 1214 ApplyMotionPath applyMotionPath) const { | 1238 ApplyMotionPath applyMotionPath) const { |
| 1215 const Vector<RefPtr<TransformOperation>>& transformOperations = | 1239 const Vector<RefPtr<TransformOperation>>& transformOperations = |
| 1216 transform().operations(); | 1240 transform().operations(); |
| 1217 | 1241 |
| 1218 // transform-origin brackets the transform with translate operations. | 1242 // transform-origin brackets the transform with translate operations. |
| 1219 // Optimize for the case where the only transform is a translation, since the
transform-origin is irrelevant | 1243 // Optimize for the case where the only transform is a translation, since the |
| 1220 // in that case. | 1244 // transform-origin is irrelevant in that case. |
| 1221 if (applyOrigin != IncludeTransformOrigin) | 1245 if (applyOrigin != IncludeTransformOrigin) |
| 1222 return false; | 1246 return false; |
| 1223 | 1247 |
| 1224 if (applyMotionPath == IncludeMotionPath) | 1248 if (applyMotionPath == IncludeMotionPath) |
| 1225 return true; | 1249 return true; |
| 1226 | 1250 |
| 1227 unsigned size = transformOperations.size(); | 1251 unsigned size = transformOperations.size(); |
| 1228 for (unsigned i = 0; i < size; ++i) { | 1252 for (unsigned i = 0; i < size; ++i) { |
| 1229 TransformOperation::OperationType type = transformOperations[i]->type(); | 1253 TransformOperation::OperationType type = transformOperations[i]->type(); |
| 1230 if (type != TransformOperation::TranslateX && | 1254 if (type != TransformOperation::TranslateX && |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 result.translate3d(-originX, -originY, -originZ); | 1327 result.translate3d(-originX, -originY, -originZ); |
| 1304 } | 1328 } |
| 1305 } | 1329 } |
| 1306 | 1330 |
| 1307 void ComputedStyle::applyMotionPathTransform( | 1331 void ComputedStyle::applyMotionPathTransform( |
| 1308 float originX, | 1332 float originX, |
| 1309 float originY, | 1333 float originY, |
| 1310 TransformationMatrix& transform) const { | 1334 TransformationMatrix& transform) const { |
| 1311 const StyleMotionData& motionData = | 1335 const StyleMotionData& motionData = |
| 1312 m_rareNonInheritedData->m_transform->m_motion; | 1336 m_rareNonInheritedData->m_transform->m_motion; |
| 1313 // TODO(ericwilligers): crbug.com/638055 Apply offset-position and offset-anch
or. | 1337 // TODO(ericwilligers): crbug.com/638055 Apply offset-position and |
| 1338 // offset-anchor. |
| 1314 if (!motionData.m_path) { | 1339 if (!motionData.m_path) { |
| 1315 return; | 1340 return; |
| 1316 } | 1341 } |
| 1317 const StylePath& motionPath = *motionData.m_path; | 1342 const StylePath& motionPath = *motionData.m_path; |
| 1318 float pathLength = motionPath.length(); | 1343 float pathLength = motionPath.length(); |
| 1319 float distance = floatValueForLength(motionData.m_distance, pathLength); | 1344 float distance = floatValueForLength(motionData.m_distance, pathLength); |
| 1320 float computedDistance; | 1345 float computedDistance; |
| 1321 if (motionPath.isClosed() && pathLength > 0) { | 1346 if (motionPath.isClosed() && pathLength > 0) { |
| 1322 computedDistance = fmod(distance, pathLength); | 1347 computedDistance = fmod(distance, pathLength); |
| 1323 if (computedDistance < 0) | 1348 if (computedDistance < 0) |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 result = decorationColorIncludingFallback(visitedLink); | 2016 result = decorationColorIncludingFallback(visitedLink); |
| 1992 break; | 2017 break; |
| 1993 default: | 2018 default: |
| 1994 ASSERT_NOT_REACHED(); | 2019 ASSERT_NOT_REACHED(); |
| 1995 break; | 2020 break; |
| 1996 } | 2021 } |
| 1997 | 2022 |
| 1998 if (!result.isCurrentColor()) | 2023 if (!result.isCurrentColor()) |
| 1999 return result.getColor(); | 2024 return result.getColor(); |
| 2000 | 2025 |
| 2001 // FIXME: Treating styled borders with initial color differently causes proble
ms | 2026 // FIXME: Treating styled borders with initial color differently causes |
| 2002 // See crbug.com/316559, crbug.com/276231 | 2027 // problems, see crbug.com/316559, crbug.com/276231 |
| 2003 if (!visitedLink && | 2028 if (!visitedLink && |
| 2004 (borderStyle == BorderStyleInset || borderStyle == BorderStyleOutset || | 2029 (borderStyle == BorderStyleInset || borderStyle == BorderStyleOutset || |
| 2005 borderStyle == BorderStyleRidge || borderStyle == BorderStyleGroove)) | 2030 borderStyle == BorderStyleRidge || borderStyle == BorderStyleGroove)) |
| 2006 return Color(238, 238, 238); | 2031 return Color(238, 238, 238); |
| 2007 return visitedLink ? visitedLinkColor() : color(); | 2032 return visitedLink ? visitedLinkColor() : color(); |
| 2008 } | 2033 } |
| 2009 | 2034 |
| 2010 Color ComputedStyle::visitedDependentColor(int colorProperty) const { | 2035 Color ComputedStyle::visitedDependentColor(int colorProperty) const { |
| 2011 Color unvisitedColor = colorIncludingFallback(colorProperty, false); | 2036 Color unvisitedColor = colorIncludingFallback(colorProperty, false); |
| 2012 if (insideLink() != InsideVisitedLink) | 2037 if (insideLink() != InsideVisitedLink) |
| 2013 return unvisitedColor; | 2038 return unvisitedColor; |
| 2014 | 2039 |
| 2015 Color visitedColor = colorIncludingFallback(colorProperty, true); | 2040 Color visitedColor = colorIncludingFallback(colorProperty, true); |
| 2016 | 2041 |
| 2017 // FIXME: Technically someone could explicitly specify the color transparent,
but for now we'll just | 2042 // FIXME: Technically someone could explicitly specify the color transparent, |
| 2018 // assume that if the background color is transparent that it wasn't set. Note
that it's weird that | 2043 // but for now we'll just assume that if the background color is transparent |
| 2019 // we're returning unvisited info for a visited link, but given our restrictio
n that the alpha values | 2044 // that it wasn't set. Note that it's weird that we're returning unvisited |
| 2020 // have to match, it makes more sense to return the unvisited background color
if specified than it | 2045 // info for a visited link, but given our restriction that the alpha values |
| 2021 // does to return black. This behavior matches what Firefox 4 does as well. | 2046 // have to match, it makes more sense to return the unvisited background color |
| 2047 // if specified than it does to return black. This behavior matches what |
| 2048 // Firefox 4 does as well. |
| 2022 if (colorProperty == CSSPropertyBackgroundColor && | 2049 if (colorProperty == CSSPropertyBackgroundColor && |
| 2023 visitedColor == Color::transparent) | 2050 visitedColor == Color::transparent) |
| 2024 return unvisitedColor; | 2051 return unvisitedColor; |
| 2025 | 2052 |
| 2026 // Take the alpha from the unvisited color, but get the RGB values from the vi
sited color. | 2053 // Take the alpha from the unvisited color, but get the RGB values from the |
| 2054 // visited color. |
| 2027 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), | 2055 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), |
| 2028 unvisitedColor.alpha()); | 2056 unvisitedColor.alpha()); |
| 2029 } | 2057 } |
| 2030 | 2058 |
| 2031 const BorderValue& ComputedStyle::borderBefore() const { | 2059 const BorderValue& ComputedStyle::borderBefore() const { |
| 2032 switch (getWritingMode()) { | 2060 switch (getWritingMode()) { |
| 2033 case TopToBottomWritingMode: | 2061 case TopToBottomWritingMode: |
| 2034 return borderTop(); | 2062 return borderTop(); |
| 2035 case LeftToRightWritingMode: | 2063 case LeftToRightWritingMode: |
| 2036 return borderLeft(); | 2064 return borderLeft(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) { | 2254 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) { |
| 2227 if (m_surround->border.m_image.outset() == outset) | 2255 if (m_surround->border.m_image.outset() == outset) |
| 2228 return; | 2256 return; |
| 2229 m_surround.access()->border.m_image.setOutset(outset); | 2257 m_surround.access()->border.m_image.setOutset(outset); |
| 2230 } | 2258 } |
| 2231 | 2259 |
| 2232 bool ComputedStyle::borderObscuresBackground() const { | 2260 bool ComputedStyle::borderObscuresBackground() const { |
| 2233 if (!hasBorder()) | 2261 if (!hasBorder()) |
| 2234 return false; | 2262 return false; |
| 2235 | 2263 |
| 2236 // Bail if we have any border-image for now. We could look at the image alpha
to improve this. | 2264 // Bail if we have any border-image for now. We could look at the image alpha |
| 2265 // to improve this. |
| 2237 if (borderImage().image()) | 2266 if (borderImage().image()) |
| 2238 return false; | 2267 return false; |
| 2239 | 2268 |
| 2240 BorderEdge edges[4]; | 2269 BorderEdge edges[4]; |
| 2241 getBorderEdgeInfo(edges); | 2270 getBorderEdgeInfo(edges); |
| 2242 | 2271 |
| 2243 for (int i = BSTop; i <= BSLeft; ++i) { | 2272 for (int i = BSTop; i <= BSLeft; ++i) { |
| 2244 const BorderEdge& currEdge = edges[i]; | 2273 const BorderEdge& currEdge = edges[i]; |
| 2245 if (!currEdge.obscuresBackground()) | 2274 if (!currEdge.obscuresBackground()) |
| 2246 return false; | 2275 return false; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 return initialGridAutoTracks(); | 2327 return initialGridAutoTracks(); |
| 2299 } | 2328 } |
| 2300 | 2329 |
| 2301 Vector<GridTrackSize> ComputedStyle::initialGridAutoRows() { | 2330 Vector<GridTrackSize> ComputedStyle::initialGridAutoRows() { |
| 2302 return initialGridAutoTracks(); | 2331 return initialGridAutoTracks(); |
| 2303 } | 2332 } |
| 2304 | 2333 |
| 2305 int adjustForAbsoluteZoom(int value, float zoomFactor) { | 2334 int adjustForAbsoluteZoom(int value, float zoomFactor) { |
| 2306 if (zoomFactor == 1) | 2335 if (zoomFactor == 1) |
| 2307 return value; | 2336 return value; |
| 2308 // Needed because computeLengthInt truncates (rather than rounds) when scaling
up. | 2337 // Needed because computeLengthInt truncates (rather than rounds) when scaling |
| 2338 // up. |
| 2309 float fvalue = value; | 2339 float fvalue = value; |
| 2310 if (zoomFactor > 1) { | 2340 if (zoomFactor > 1) { |
| 2311 if (value < 0) | 2341 if (value < 0) |
| 2312 fvalue -= 0.5f; | 2342 fvalue -= 0.5f; |
| 2313 else | 2343 else |
| 2314 fvalue += 0.5f; | 2344 fvalue += 0.5f; |
| 2315 } | 2345 } |
| 2316 | 2346 |
| 2317 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2347 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2318 } | 2348 } |
| 2319 | 2349 |
| 2320 } // namespace blink | 2350 } // namespace blink |
| OLD | NEW |