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
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (width.isIntrinsicOrAuto() | 359 if (width.isIntrinsicOrAuto() |
360 && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left()) | 360 && ((!a.left().isIntrinsicOrAuto() && a.left() != b.left()) |
361 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) | 361 || (!a.right().isIntrinsicOrAuto() && a.right() != b.right()))) |
362 return false; | 362 return false; |
363 | 363 |
364 // One of the units is fixed or percent in both directions and stayed | 364 // One of the units is fixed or percent in both directions and stayed |
365 // that way in the new style. Therefore all we are doing is moving. | 365 // that way in the new style. Therefore all we are doing is moving. |
366 return true; | 366 return true; |
367 } | 367 } |
368 | 368 |
369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other, un
signed& changedContextSensitiveProperties) const | 369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
nst |
370 { | 370 { |
371 changedContextSensitiveProperties = ContextSensitivePropertyNone; | |
372 | |
373 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep | 371 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep |
374 // compare, which is duplicate work when we're going to compare each propert
y inside | 372 // compare, which is duplicate work when we're going to compare each propert
y inside |
375 // this function anyway. | 373 // this function anyway. |
376 | 374 |
377 StyleDifference svgChange = StyleDifferenceEqual; | 375 StyleDifference diff; |
378 if (m_svgStyle.get() != other.m_svgStyle.get()) { | 376 if (m_svgStyle.get() != other.m_svgStyle.get()) |
379 svgChange = m_svgStyle->diff(other.m_svgStyle.get()); | 377 diff = m_svgStyle->diff(other.m_svgStyle.get()); |
380 if (svgChange == StyleDifferenceLayout) | 378 |
381 return svgChange; | 379 if ((!diff.needsRepaintLayer() || !diff.needsFullLayout()) && diffNeedsLayou
tAndRepaintLayer(other)) { |
| 380 diff.setNeedsFullLayout(); |
| 381 diff.setNeedsRepaintLayer(); |
382 } | 382 } |
383 | 383 |
| 384 if ((!diff.needsRepaint() || !diff.needsFullLayout()) && diffNeedsLayoutAndR
epaintSelf(other)) { |
| 385 diff.setNeedsFullLayout(); |
| 386 diff.setNeedsRepaintSelf(); |
| 387 } |
| 388 |
| 389 if (!diff.needsFullLayout() && diffNeedsLayoutOnly(other)) |
| 390 diff.setNeedsFullLayout(); |
| 391 |
| 392 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { |
| 393 // Optimize for the case where a positioned layer is moving but not chan
ging size. |
| 394 if ((position() == AbsolutePosition || position() == FixedPosition) |
| 395 && positionedObjectMovedOnly(surround->offset, other.surround->offse
t, m_box->width())) { |
| 396 diff.setNeedsPositionedMovementLayout(); |
| 397 } else { |
| 398 // FIXME: We would like to use SimplifiedLayout for relative positio
ning, but we can't quite do that yet. |
| 399 // We need to make sure SimplifiedLayout can operate correctly on Re
nderInlines (we will need |
| 400 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). |
| 401 diff.setNeedsFullLayout(); |
| 402 diff.setNeedsRepaintSelf(); |
| 403 } |
| 404 } |
| 405 |
| 406 if (!diff.needsRepaintLayer() && diffNeedsRepaintLayerOnly(other)) |
| 407 diff.setNeedsRepaintLayer(); |
| 408 |
| 409 if (!diff.needsRepaint() && diffNeedsRepaintOnly(other)) |
| 410 diff.setNeedsRepaintSelf(); |
| 411 |
| 412 addContextSensitiveDiffFlags(other, diff); |
| 413 |
| 414 if (diff.noChange() && diffNeedsRecompositeLayerOnly(other)) |
| 415 diff.setNeedsRecompositeLayer(); |
| 416 |
| 417 // Cursors are not checked, since they will be set appropriately in response
to mouse events, |
| 418 // so they don't need to cause any repaint or layout. |
| 419 |
| 420 // Animations don't need to be checked either. We always set the new style o
n the RenderObject, so we will get a chance to fire off |
| 421 // the resulting transition properly. |
| 422 |
| 423 return diff; |
| 424 } |
| 425 |
| 426 bool RenderStyle::diffNeedsLayoutAndRepaintLayer(const RenderStyle& other) const |
| 427 { |
| 428 if (position() != other.position()) |
| 429 return true; |
| 430 |
| 431 return false; |
| 432 } |
| 433 |
| 434 bool RenderStyle::diffNeedsLayoutAndRepaintSelf(const RenderStyle& other) const |
| 435 { |
384 if (m_box.get() != other.m_box.get()) { | 436 if (m_box.get() != other.m_box.get()) { |
385 if (m_box->width() != other.m_box->width() | 437 if (m_box->width() != other.m_box->width() |
386 || m_box->minWidth() != other.m_box->minWidth() | 438 || m_box->minWidth() != other.m_box->minWidth() |
387 || m_box->maxWidth() != other.m_box->maxWidth() | 439 || m_box->maxWidth() != other.m_box->maxWidth() |
388 || m_box->height() != other.m_box->height() | 440 || m_box->height() != other.m_box->height() |
389 || m_box->minHeight() != other.m_box->minHeight() | 441 || m_box->minHeight() != other.m_box->minHeight() |
390 || m_box->maxHeight() != other.m_box->maxHeight()) | 442 || m_box->maxHeight() != other.m_box->maxHeight()) |
391 return StyleDifferenceLayout; | 443 return true; |
392 | 444 |
393 if (m_box->verticalAlign() != other.m_box->verticalAlign()) | 445 if (m_box->verticalAlign() != other.m_box->verticalAlign()) |
394 return StyleDifferenceLayout; | 446 return true; |
395 | 447 |
396 if (m_box->boxSizing() != other.m_box->boxSizing()) | 448 if (m_box->boxSizing() != other.m_box->boxSizing()) |
397 return StyleDifferenceLayout; | 449 return true; |
398 } | 450 } |
399 | 451 |
400 if (surround.get() != other.surround.get()) { | 452 if (surround.get() != other.surround.get()) { |
401 if (surround->margin != other.surround->margin) | 453 if (surround->margin != other.surround->margin) |
402 return StyleDifferenceLayout; | 454 return true; |
403 | 455 |
404 if (surround->padding != other.surround->padding) | 456 if (surround->padding != other.surround->padding) |
405 return StyleDifferenceLayout; | 457 return true; |
406 | 458 |
407 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a repaint. | 459 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a repaint. |
408 if (borderLeftWidth() != other.borderLeftWidth() | 460 if (borderLeftWidth() != other.borderLeftWidth() |
409 || borderTopWidth() != other.borderTopWidth() | 461 || borderTopWidth() != other.borderTopWidth() |
410 || borderBottomWidth() != other.borderBottomWidth() | 462 || borderBottomWidth() != other.borderBottomWidth() |
411 || borderRightWidth() != other.borderRightWidth()) | 463 || borderRightWidth() != other.borderRightWidth()) |
412 return StyleDifferenceLayout; | 464 return true; |
413 } | 465 } |
414 | 466 |
415 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 467 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
416 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance | 468 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance |
417 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse | 469 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse |
418 || rareNonInheritedData->marginAfterCollapse != other.rareNonInherit
edData->marginAfterCollapse | 470 || rareNonInheritedData->marginAfterCollapse != other.rareNonInherit
edData->marginAfterCollapse |
419 || rareNonInheritedData->lineClamp != other.rareNonInheritedData->li
neClamp | 471 || rareNonInheritedData->lineClamp != other.rareNonInheritedData->li
neClamp |
420 || rareNonInheritedData->textOverflow != other.rareNonInheritedData-
>textOverflow | 472 || rareNonInheritedData->textOverflow != other.rareNonInheritedData-
>textOverflow |
421 || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m
_wrapFlow | 473 || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m
_wrapFlow |
422 || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData
->m_wrapThrough | 474 || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData
->m_wrapThrough |
423 || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData
->m_shapeMargin | 475 || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData
->m_shapeMargin |
424 || rareNonInheritedData->m_order != other.rareNonInheritedData->m_or
der | 476 || rareNonInheritedData->m_order != other.rareNonInheritedData->m_or
der |
425 || rareNonInheritedData->m_alignContent != other.rareNonInheritedDat
a->m_alignContent | 477 || rareNonInheritedData->m_alignContent != other.rareNonInheritedDat
a->m_alignContent |
426 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData-
>m_alignItems | 478 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData-
>m_alignItems |
427 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->
m_alignSelf | 479 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->
m_alignSelf |
428 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedD
ata->m_justifyContent | 480 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedD
ata->m_justifyContent |
429 || rareNonInheritedData->m_grid.get() != other.rareNonInheritedData-
>m_grid.get() | 481 || rareNonInheritedData->m_grid.get() != other.rareNonInheritedData-
>m_grid.get() |
430 || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedD
ata->m_gridItem.get() | 482 || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedD
ata->m_gridItem.get() |
431 || rareNonInheritedData->m_textCombine != other.rareNonInheritedData
->m_textCombine | 483 || rareNonInheritedData->m_textCombine != other.rareNonInheritedData
->m_textCombine |
432 || rareNonInheritedData->hasFilters() != other.rareNonInheritedData-
>hasFilters()) | 484 || rareNonInheritedData->hasFilters() != other.rareNonInheritedData-
>hasFilters()) |
433 return StyleDifferenceLayout; | 485 return true; |
434 | 486 |
435 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon
InheritedData->m_deprecatedFlexibleBox.get() | 487 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon
InheritedData->m_deprecatedFlexibleBox.get() |
436 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra
reNonInheritedData->m_deprecatedFlexibleBox.get()) | 488 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra
reNonInheritedData->m_deprecatedFlexibleBox.get()) |
437 return StyleDifferenceLayout; | 489 return true; |
438 | 490 |
439 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD
ata->m_flexibleBox.get() | 491 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD
ata->m_flexibleBox.get() |
440 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher
itedData->m_flexibleBox.get()) | 492 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher
itedData->m_flexibleBox.get()) |
441 return StyleDifferenceLayout; | 493 return true; |
442 | 494 |
443 // FIXME: We should add an optimized form of layout that just recomputes
visual overflow. | 495 // FIXME: We should add an optimized form of layout that just recomputes
visual overflow. |
444 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD
ata.get())) | 496 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD
ata.get())) |
445 return StyleDifferenceLayout; | 497 return true; |
446 | 498 |
447 if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheri
tedData.get())) | 499 if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheri
tedData.get())) |
448 return StyleDifferenceLayout; | 500 return true; |
449 | 501 |
450 if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData
->m_multiCol.get() | 502 if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData
->m_multiCol.get() |
451 && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInherite
dData->m_multiCol.get()) | 503 && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInherite
dData->m_multiCol.get()) |
452 return StyleDifferenceLayout; | 504 return true; |
453 | |
454 if (!transformDataEquivalent(other)) { | |
455 // Don't return early here; instead take note of the type of | |
456 // change, and deal with it when looking at compositing. | |
457 changedContextSensitiveProperties |= ContextSensitivePropertyTransfo
rm; | |
458 } | |
459 | 505 |
460 // If the counter directives change, trigger a relayout to re-calculate
counter values and rebuild the counter node tree. | 506 // If the counter directives change, trigger a relayout to re-calculate
counter values and rebuild the counter node tree. |
461 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti
ves.get(); | 507 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti
ves.get(); |
462 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD
irectives.get(); | 508 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD
irectives.get(); |
463 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) | 509 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) |
464 return StyleDifferenceLayout; | 510 return true; |
465 | 511 |
466 // We only need do layout for opacity changes if adding or losing opacit
y could trigger a change | 512 // We only need do layout for opacity changes if adding or losing opacit
y could trigger a change |
467 // in us being a stacking context. | 513 // in us being a stacking context. |
468 if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->ha
sOpacity() != other.rareNonInheritedData->hasOpacity()) { | 514 if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->ha
sOpacity() != other.rareNonInheritedData->hasOpacity()) { |
469 // FIXME: We would like to use SimplifiedLayout here, but we can't q
uite do that yet. | 515 // FIXME: We would like to use SimplifiedLayout here, but we can't q
uite do that yet. |
470 // We need to make sure SimplifiedLayout can operate correctly on Re
nderInlines (we will need | 516 // We need to make sure SimplifiedLayout can operate correctly on Re
nderInlines (we will need |
471 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). | 517 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). |
472 // In addition we need to solve the floating object issue when layer
s come and go. Right now | 518 // In addition we need to solve the floating object issue when layer
s come and go. Right now |
473 // a full layout is necessary to keep floating object lists sane. | 519 // a full layout is necessary to keep floating object lists sane. |
474 return StyleDifferenceLayout; | 520 return true; |
475 } | 521 } |
476 } | 522 } |
477 | 523 |
478 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 524 if (rareInheritedData.get() != other.rareInheritedData.get()) { |
479 if (rareInheritedData->highlight != other.rareInheritedData->highlight | 525 if (rareInheritedData->highlight != other.rareInheritedData->highlight |
480 || rareInheritedData->indent != other.rareInheritedData->indent | 526 || rareInheritedData->indent != other.rareInheritedData->indent |
481 || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_
textAlignLast | 527 || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_
textAlignLast |
482 || rareInheritedData->m_textIndentLine != other.rareInheritedData->m
_textIndentLine | 528 || rareInheritedData->m_textIndentLine != other.rareInheritedData->m
_textIndentLine |
483 || rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_
effectiveZoom | 529 || rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_
effectiveZoom |
484 || rareInheritedData->wordBreak != other.rareInheritedData->wordBrea
k | 530 || rareInheritedData->wordBreak != other.rareInheritedData->wordBrea
k |
485 || rareInheritedData->overflowWrap != other.rareInheritedData->overf
lowWrap | 531 || rareInheritedData->overflowWrap != other.rareInheritedData->overf
lowWrap |
486 || rareInheritedData->lineBreak != other.rareInheritedData->lineBrea
k | 532 || rareInheritedData->lineBreak != other.rareInheritedData->lineBrea
k |
487 || rareInheritedData->textSecurity != other.rareInheritedData->textS
ecurity | 533 || rareInheritedData->textSecurity != other.rareInheritedData->textS
ecurity |
488 || rareInheritedData->hyphens != other.rareInheritedData->hyphens | 534 || rareInheritedData->hyphens != other.rareInheritedData->hyphens |
489 || rareInheritedData->hyphenationLimitBefore != other.rareInheritedD
ata->hyphenationLimitBefore | 535 || rareInheritedData->hyphenationLimitBefore != other.rareInheritedD
ata->hyphenationLimitBefore |
490 || rareInheritedData->hyphenationLimitAfter != other.rareInheritedDa
ta->hyphenationLimitAfter | 536 || rareInheritedData->hyphenationLimitAfter != other.rareInheritedDa
ta->hyphenationLimitAfter |
491 || rareInheritedData->hyphenationString != other.rareInheritedData->
hyphenationString | 537 || rareInheritedData->hyphenationString != other.rareInheritedData->
hyphenationString |
492 || rareInheritedData->locale != other.rareInheritedData->locale | 538 || rareInheritedData->locale != other.rareInheritedData->locale |
493 || rareInheritedData->m_rubyPosition != other.rareInheritedData->m_r
ubyPosition | 539 || rareInheritedData->m_rubyPosition != other.rareInheritedData->m_r
ubyPosition |
494 || rareInheritedData->textEmphasisMark != other.rareInheritedData->t
extEmphasisMark | 540 || rareInheritedData->textEmphasisMark != other.rareInheritedData->t
extEmphasisMark |
495 || rareInheritedData->textEmphasisPosition != other.rareInheritedDat
a->textEmphasisPosition | 541 || rareInheritedData->textEmphasisPosition != other.rareInheritedDat
a->textEmphasisPosition |
496 || rareInheritedData->textEmphasisCustomMark != other.rareInheritedD
ata->textEmphasisCustomMark | 542 || rareInheritedData->textEmphasisCustomMark != other.rareInheritedD
ata->textEmphasisCustomMark |
497 || rareInheritedData->m_textJustify != other.rareInheritedData->m_te
xtJustify | 543 || rareInheritedData->m_textJustify != other.rareInheritedData->m_te
xtJustify |
498 || rareInheritedData->m_textOrientation != other.rareInheritedData->
m_textOrientation | 544 || rareInheritedData->m_textOrientation != other.rareInheritedData->
m_textOrientation |
499 || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSiz
e | 545 || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSiz
e |
500 || rareInheritedData->m_lineBoxContain != other.rareInheritedData->m
_lineBoxContain | 546 || rareInheritedData->m_lineBoxContain != other.rareInheritedData->m
_lineBoxContain |
501 || rareInheritedData->listStyleImage != other.rareInheritedData->lis
tStyleImage | 547 || rareInheritedData->listStyleImage != other.rareInheritedData->lis
tStyleImage |
502 || rareInheritedData->textStrokeWidth != other.rareInheritedData->te
xtStrokeWidth) | 548 || rareInheritedData->textStrokeWidth != other.rareInheritedData->te
xtStrokeWidth) |
503 return StyleDifferenceLayout; | 549 return true; |
504 | 550 |
505 if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.ge
t())) | 551 if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.ge
t())) |
506 return StyleDifferenceLayout; | 552 return true; |
507 | 553 |
508 if (rareInheritedData->quotes.get() != other.rareInheritedData->quotes.g
et()) | 554 if (rareInheritedData->quotes.get() != other.rareInheritedData->quotes.g
et()) |
509 return StyleDifferenceLayout; | 555 return true; |
510 } | 556 } |
511 | 557 |
512 if (visual->m_textAutosizingMultiplier != other.visual->m_textAutosizingMult
iplier) | 558 if (visual->m_textAutosizingMultiplier != other.visual->m_textAutosizingMult
iplier) |
513 return StyleDifferenceLayout; | 559 return true; |
514 | 560 |
515 if (inherited.get() != other.inherited.get()) { | 561 if (inherited.get() != other.inherited.get()) { |
516 if (inherited->line_height != other.inherited->line_height | 562 if (inherited->line_height != other.inherited->line_height |
517 || inherited->font != other.inherited->font | 563 || inherited->font != other.inherited->font |
518 || inherited->horizontal_border_spacing != other.inherited->horizontal_b
order_spacing | 564 || inherited->horizontal_border_spacing != other.inherited->horizontal_b
order_spacing |
519 || inherited->vertical_border_spacing != other.inherited->vertical_borde
r_spacing) | 565 || inherited->vertical_border_spacing != other.inherited->vertical_borde
r_spacing) |
520 return StyleDifferenceLayout; | 566 return true; |
521 } | 567 } |
522 | 568 |
523 if (inherited_flags._box_direction != other.inherited_flags._box_direction | 569 if (inherited_flags._box_direction != other.inherited_flags._box_direction |
524 || inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering | 570 || inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering |
525 || inherited_flags._text_align != other.inherited_flags._text_align | 571 || inherited_flags._text_align != other.inherited_flags._text_align |
526 || inherited_flags._text_transform != other.inherited_flags._text_transf
orm | 572 || inherited_flags._text_transform != other.inherited_flags._text_transf
orm |
527 || inherited_flags._direction != other.inherited_flags._direction | 573 || inherited_flags._direction != other.inherited_flags._direction |
528 || inherited_flags._white_space != other.inherited_flags._white_space | 574 || inherited_flags._white_space != other.inherited_flags._white_space |
529 || inherited_flags.m_writingMode != other.inherited_flags.m_writingMode) | 575 || inherited_flags.m_writingMode != other.inherited_flags.m_writingMode) |
530 return StyleDifferenceLayout; | 576 return true; |
531 | 577 |
532 if (noninherited_flags._overflowX != other.noninherited_flags._overflowX | 578 if (noninherited_flags._overflowX != other.noninherited_flags._overflowX |
533 || noninherited_flags._overflowY != other.noninherited_flags._overflowY | 579 || noninherited_flags._overflowY != other.noninherited_flags._overflowY |
534 || noninherited_flags._clear != other.noninherited_flags._clear | 580 || noninherited_flags._clear != other.noninherited_flags._clear |
535 || noninherited_flags._unicodeBidi != other.noninherited_flags._unicodeB
idi | 581 || noninherited_flags._unicodeBidi != other.noninherited_flags._unicodeB
idi |
536 || noninherited_flags._position != other.noninherited_flags._position | 582 || noninherited_flags._position != other.noninherited_flags._position |
537 || noninherited_flags._floating != other.noninherited_flags._floating | 583 || noninherited_flags._floating != other.noninherited_flags._floating |
538 || noninherited_flags._originalDisplay != other.noninherited_flags._orig
inalDisplay | 584 || noninherited_flags._originalDisplay != other.noninherited_flags._orig
inalDisplay |
539 || noninherited_flags._vertical_align != other.noninherited_flags._verti
cal_align) | 585 || noninherited_flags._vertical_align != other.noninherited_flags._verti
cal_align) |
540 return StyleDifferenceLayout; | 586 return true; |
541 | 587 |
542 if (noninherited_flags._effectiveDisplay >= FIRST_TABLE_DISPLAY && noninheri
ted_flags._effectiveDisplay <= LAST_TABLE_DISPLAY) { | 588 if (noninherited_flags._effectiveDisplay >= FIRST_TABLE_DISPLAY && noninheri
ted_flags._effectiveDisplay <= LAST_TABLE_DISPLAY) { |
543 if (inherited_flags._border_collapse != other.inherited_flags._border_co
llapse | 589 if (inherited_flags._border_collapse != other.inherited_flags._border_co
llapse |
544 || inherited_flags._empty_cells != other.inherited_flags._empty_cell
s | 590 || inherited_flags._empty_cells != other.inherited_flags._empty_cell
s |
545 || inherited_flags._caption_side != other.inherited_flags._caption_s
ide | 591 || inherited_flags._caption_side != other.inherited_flags._caption_s
ide |
546 || noninherited_flags._table_layout != other.noninherited_flags._tab
le_layout) | 592 || noninherited_flags._table_layout != other.noninherited_flags._tab
le_layout) |
547 return StyleDifferenceLayout; | 593 return true; |
548 | 594 |
549 // In the collapsing border model, 'hidden' suppresses other borders, wh
ile 'none' | 595 // In the collapsing border model, 'hidden' suppresses other borders, wh
ile 'none' |
550 // does not, so these style differences can be width differences. | 596 // does not, so these style differences can be width differences. |
551 if (inherited_flags._border_collapse | 597 if (inherited_flags._border_collapse |
552 && ((borderTopStyle() == BHIDDEN && other.borderTopStyle() == BNONE) | 598 && ((borderTopStyle() == BHIDDEN && other.borderTopStyle() == BNONE) |
553 || (borderTopStyle() == BNONE && other.borderTopStyle() == BHIDD
EN) | 599 || (borderTopStyle() == BNONE && other.borderTopStyle() == BHIDD
EN) |
554 || (borderBottomStyle() == BHIDDEN && other.borderBottomStyle()
== BNONE) | 600 || (borderBottomStyle() == BHIDDEN && other.borderBottomStyle()
== BNONE) |
555 || (borderBottomStyle() == BNONE && other.borderBottomStyle() ==
BHIDDEN) | 601 || (borderBottomStyle() == BNONE && other.borderBottomStyle() ==
BHIDDEN) |
556 || (borderLeftStyle() == BHIDDEN && other.borderLeftStyle() == B
NONE) | 602 || (borderLeftStyle() == BHIDDEN && other.borderLeftStyle() == B
NONE) |
557 || (borderLeftStyle() == BNONE && other.borderLeftStyle() == BHI
DDEN) | 603 || (borderLeftStyle() == BNONE && other.borderLeftStyle() == BHI
DDEN) |
558 || (borderRightStyle() == BHIDDEN && other.borderRightStyle() ==
BNONE) | 604 || (borderRightStyle() == BHIDDEN && other.borderRightStyle() ==
BNONE) |
559 || (borderRightStyle() == BNONE && other.borderRightStyle() == B
HIDDEN))) | 605 || (borderRightStyle() == BNONE && other.borderRightStyle() == B
HIDDEN))) |
560 return StyleDifferenceLayout; | 606 return true; |
561 } else if (noninherited_flags._effectiveDisplay == LIST_ITEM) { | 607 } else if (noninherited_flags._effectiveDisplay == LIST_ITEM) { |
562 if (inherited_flags._list_style_type != other.inherited_flags._list_styl
e_type | 608 if (inherited_flags._list_style_type != other.inherited_flags._list_styl
e_type |
563 || inherited_flags._list_style_position != other.inherited_flags._li
st_style_position) | 609 || inherited_flags._list_style_position != other.inherited_flags._li
st_style_position) |
564 return StyleDifferenceLayout; | 610 return true; |
565 } | 611 } |
566 | 612 |
567 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) | 613 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) |
568 return StyleDifferenceLayout; | 614 return true; |
569 | 615 |
570 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { | 616 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { |
571 // FIXME: We only really need to recompute the overflow but we don't hav
e an optimized layout for it. | 617 // FIXME: We only really need to recompute the overflow but we don't hav
e an optimized layout for it. |
572 return StyleDifferenceLayout; | 618 return true; |
573 } | 619 } |
574 | 620 |
575 // SVGRenderStyle::diff() might have returned StyleDifferenceRepaint, eg. if
fill changes. | 621 // Movement of non-static-positioned object is special cased in RenderStyle:
:visualInvalidationDiff(). |
576 // If eg. the font-size changed at the same time, we're not allowed to retur
n StyleDifferenceRepaint, | |
577 // but have to return StyleDifferenceLayout, that's why this if branch come
s after all branches | |
578 // that are relevant for SVG and might return StyleDifferenceLayout. | |
579 if (svgChange != StyleDifferenceEqual) | |
580 return svgChange; | |
581 | 622 |
582 // NOTE: This block must be last in this function for the StyleDifferenceLay
outPositionedMovementOnly | 623 return false; |
583 // optimization to work properly. | |
584 if (position() != StaticPosition && surround->offset != other.surround->offs
et) { | |
585 // Optimize for the case where a positioned layer is moving but not chan
ging size. | |
586 if ((position() == AbsolutePosition || position() == FixedPosition) | |
587 && positionedObjectMovedOnly(surround->offset, other.surround->offse
t, m_box->width()) | |
588 && repaintOnlyDiff(other, changedContextSensitiveProperties) == Styl
eDifferenceEqual) | |
589 return StyleDifferenceLayoutPositionedMovementOnly; | |
590 // FIXME: We would like to use SimplifiedLayout for relative positioning
, but we can't quite do that yet. | |
591 // We need to make sure SimplifiedLayout can operate correctly on Render
Inlines (we will need | |
592 // to add a selfNeedsSimplifiedLayout bit in order to not get confused a
nd taint every line). | |
593 return StyleDifferenceLayout; | |
594 } | |
595 | |
596 StyleDifference repaintDifference = repaintOnlyDiff(other, changedContextSen
sitiveProperties); | |
597 ASSERT(repaintDifference <= StyleDifferenceRepaintLayer); | |
598 return repaintDifference; | |
599 } | 624 } |
600 | 625 |
601 StyleDifference RenderStyle::repaintOnlyDiff(const RenderStyle& other, unsigned&
changedContextSensitiveProperties) const | 626 bool RenderStyle::diffNeedsLayoutOnly(const RenderStyle& other) const |
602 { | 627 { |
603 if (position() != StaticPosition && (m_box->zIndex() != other.m_box->zIndex(
) || m_box->hasAutoZIndex() != other.m_box->hasAutoZIndex() | 628 // FIXME: Examine cases in needsFullLayoutAndRepaintLayer() and needsFullLay
outAndRepaintSelf() |
604 || visual->clip != other.visual->clip || visual->hasClip != other.visual
->hasClip)) | 629 // and move cases that don't need repaint into this method. |
605 return StyleDifferenceRepaintLayer; | 630 return false; |
| 631 } |
| 632 |
| 633 bool RenderStyle::diffNeedsRepaintLayerOnly(const RenderStyle& other) const |
| 634 { |
| 635 if (position() != StaticPosition && (visual->clip != other.visual->clip || v
isual->hasClip != other.visual->hasClip)) |
| 636 return true; |
606 | 637 |
607 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData
->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode | 638 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData
->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode |
608 || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_is
olation)) | 639 || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_is
olation)) |
609 return StyleDifferenceRepaintLayer; | 640 return true; |
610 | |
611 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity) { | |
612 // Don't return early here; instead take note of the type of change, | |
613 // and deal with it when looking at compositing. | |
614 changedContextSensitiveProperties |= ContextSensitivePropertyOpacity; | |
615 } | |
616 | |
617 if (rareNonInheritedData->m_filter.get() != other.rareNonInheritedData->m_fi
lter.get() | |
618 && *rareNonInheritedData->m_filter.get() != *other.rareNonInheritedData-
>m_filter.get()) { | |
619 // Don't return early here; instead take note of the type of change, | |
620 // and deal with it when looking at compositing. | |
621 changedContextSensitiveProperties |= ContextSensitivePropertyFilter; | |
622 } | |
623 | 641 |
624 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask | 642 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask |
625 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m
_maskBoxImage) | 643 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m
_maskBoxImage) |
626 return StyleDifferenceRepaintLayer; | 644 return true; |
627 | 645 |
| 646 return false; |
| 647 } |
| 648 |
| 649 bool RenderStyle::diffNeedsRepaintOnly(const RenderStyle& other) const |
| 650 { |
628 if (inherited_flags._visibility != other.inherited_flags._visibility | 651 if (inherited_flags._visibility != other.inherited_flags._visibility |
629 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo
lorAdjust | 652 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo
lorAdjust |
630 || inherited_flags._insideLink != other.inherited_flags._insideLink | 653 || inherited_flags._insideLink != other.inherited_flags._insideLink |
631 || !surround->border.visuallyEqual(other.surround->border) | 654 || !surround->border.visuallyEqual(other.surround->border) |
632 || !m_background->visuallyEqual(*other.m_background) | 655 || !m_background->visuallyEqual(*other.m_background) |
633 || rareInheritedData->userModify != other.rareInheritedData->userModify | 656 || rareInheritedData->userModify != other.rareInheritedData->userModify |
634 || rareInheritedData->userSelect != other.rareInheritedData->userSelect | 657 || rareInheritedData->userSelect != other.rareInheritedData->userSelect |
635 || rareNonInheritedData->userDrag != other.rareNonInheritedData->userDra
g | 658 || rareNonInheritedData->userDrag != other.rareNonInheritedData->userDra
g |
636 || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_bo
rderFit | 659 || rareNonInheritedData->m_borderFit != other.rareNonInheritedData->m_bo
rderFit |
637 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_ob
jectFit | 660 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->m_ob
jectFit |
638 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedData-
>m_objectPosition | 661 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedData-
>m_objectPosition |
639 || rareInheritedData->m_imageRendering != other.rareInheritedData->m_ima
geRendering) | 662 || rareInheritedData->m_imageRendering != other.rareInheritedData->m_ima
geRendering) |
640 return StyleDifferenceRepaint; | 663 return true; |
641 | 664 |
642 if (rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->
m_shapeOutside) | 665 if (rareNonInheritedData->m_shapeOutside != other.rareNonInheritedData->m_sh
apeOutside) |
643 return StyleDifferenceRepaint; | 666 return true; |
644 | 667 |
645 if (rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_cl
ipPath) | 668 if (rareNonInheritedData->m_clipPath != other.rareNonInheritedData->m_clipPa
th) |
646 return StyleDifferenceRepaint; | 669 return true; |
647 | 670 |
| 671 return false; |
| 672 } |
| 673 |
| 674 bool RenderStyle::diffNeedsRecompositeLayerOnly(const RenderStyle& other) const |
| 675 { |
648 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 676 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
649 if (rareNonInheritedData->m_transformStyle3D != other.rareNonInheritedDa
ta->m_transformStyle3D | 677 if (rareNonInheritedData->m_transformStyle3D != other.rareNonInheritedDa
ta->m_transformStyle3D |
650 || rareNonInheritedData->m_backfaceVisibility != other.rareNonInheri
tedData->m_backfaceVisibility | 678 || rareNonInheritedData->m_backfaceVisibility != other.rareNonInheri
tedData->m_backfaceVisibility |
651 || rareNonInheritedData->m_perspective != other.rareNonInheritedData
->m_perspective | 679 || rareNonInheritedData->m_perspective != other.rareNonInheritedData
->m_perspective |
652 || rareNonInheritedData->m_perspectiveOriginX != other.rareNonInheri
tedData->m_perspectiveOriginX | 680 || rareNonInheritedData->m_perspectiveOriginX != other.rareNonInheri
tedData->m_perspectiveOriginX |
653 || rareNonInheritedData->m_perspectiveOriginY != other.rareNonInheri
tedData->m_perspectiveOriginY | 681 || rareNonInheritedData->m_perspectiveOriginY != other.rareNonInheri
tedData->m_perspectiveOriginY |
654 || hasWillChangeCompositingHint() != other.hasWillChangeCompositingH
int() | 682 || hasWillChangeCompositingHint() != other.hasWillChangeCompositingH
int() |
655 || hasWillChangeGpuRasterizationHint() != other.hasWillChangeGpuRast
erizationHint()) | 683 || hasWillChangeGpuRasterizationHint() != other.hasWillChangeGpuRast
erizationHint()) |
656 return StyleDifferenceRecompositeLayer; | 684 return true; |
657 } | 685 } |
658 | 686 |
659 if (inherited->color != other.inherited->color | 687 return false; |
660 || inherited_flags._text_decorations != other.inherited_flags._text_deco
rations | 688 } |
661 || visual->textDecoration != other.visual->textDecoration | |
662 || rareNonInheritedData->m_textDecorationStyle != other.rareNonInherited
Data->m_textDecorationStyle | |
663 || rareNonInheritedData->m_textDecorationColor != other.rareNonInherited
Data->m_textDecorationColor | |
664 || rareInheritedData->textFillColor() != other.rareInheritedData->textFi
llColor() | |
665 || rareInheritedData->textStrokeColor() != other.rareInheritedData->text
StrokeColor() | |
666 || rareInheritedData->textEmphasisColor() != other.rareInheritedData->te
xtEmphasisColor() | |
667 || rareInheritedData->textEmphasisFill != other.rareInheritedData->textE
mphasisFill) | |
668 changedContextSensitiveProperties |= ContextSensitivePropertyTextOrColor
; | |
669 | 689 |
670 // Cursors are not checked, since they will be set appropriately in response
to mouse events, | 690 void RenderStyle::addContextSensitiveDiffFlags(const RenderStyle& other, StyleDi
fference& diff) const |
671 // so they don't need to cause any repaint or layout. | 691 { |
| 692 if (position() != StaticPosition && (m_box->zIndex() != other.m_box->zIndex(
) || m_box->hasAutoZIndex() != other.m_box->hasAutoZIndex())) |
| 693 diff.setZIndexChanged(); |
672 | 694 |
673 // Animations don't need to be checked either. We always set the new style
on the RenderObject, so we will get a chance to fire off | 695 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
674 // the resulting transition properly. | 696 if (!transformDataEquivalent(other)) |
675 return StyleDifferenceEqual; | 697 diff.setTransformChanged(); |
| 698 |
| 699 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity
) |
| 700 diff.setOpacityChanged(); |
| 701 |
| 702 if (rareNonInheritedData->m_filter.get() != other.rareNonInheritedData->
m_filter.get() |
| 703 && *rareNonInheritedData->m_filter.get() != *other.rareNonInheritedD
ata->m_filter.get()) |
| 704 diff.setFilterChanged(); |
| 705 } |
| 706 |
| 707 if (!diff.needsRepaint()) { |
| 708 if (inherited->color != other.inherited->color |
| 709 || inherited_flags._text_decorations != other.inherited_flags._text_
decorations |
| 710 || visual->textDecoration != other.visual->textDecoration |
| 711 || rareNonInheritedData->m_textDecorationStyle != other.rareNonInher
itedData->m_textDecorationStyle |
| 712 || rareNonInheritedData->m_textDecorationColor != other.rareNonInher
itedData->m_textDecorationColor |
| 713 || rareInheritedData->textFillColor() != other.rareInheritedData->te
xtFillColor() |
| 714 || rareInheritedData->textStrokeColor() != other.rareInheritedData->
textStrokeColor() |
| 715 || rareInheritedData->textEmphasisColor() != other.rareInheritedData
->textEmphasisColor() |
| 716 || rareInheritedData->textEmphasisFill != other.rareInheritedData->t
extEmphasisFill) |
| 717 diff.setTextOrColorChanged(); |
| 718 } |
676 } | 719 } |
677 | 720 |
678 void RenderStyle::setClip(Length top, Length right, Length bottom, Length left) | 721 void RenderStyle::setClip(Length top, Length right, Length bottom, Length left) |
679 { | 722 { |
680 StyleVisualData* data = visual.access(); | 723 StyleVisualData* data = visual.access(); |
681 data->clip.m_top = top; | 724 data->clip.m_top = top; |
682 data->clip.m_right = right; | 725 data->clip.m_right = right; |
683 data->clip.m_bottom = bottom; | 726 data->clip.m_bottom = bottom; |
684 data->clip.m_left = left; | 727 data->clip.m_left = left; |
685 } | 728 } |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 // right | 1698 // right |
1656 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1699 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1657 if (radiiSum > rect.height()) | 1700 if (radiiSum > rect.height()) |
1658 factor = std::min(rect.height() / radiiSum, factor); | 1701 factor = std::min(rect.height() / radiiSum, factor); |
1659 | 1702 |
1660 ASSERT(factor <= 1); | 1703 ASSERT(factor <= 1); |
1661 return factor; | 1704 return factor; |
1662 } | 1705 } |
1663 | 1706 |
1664 } // namespace WebCore | 1707 } // namespace WebCore |
OLD | NEW |