Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 136693009: Refactor RenderStyle::diff to be grouped by type and guard with pointer compares on structs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment per ojan and rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/rendering/style/RenderStyleConstants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 // One of the units is fixed or percent in both directions and stayed 363 // One of the units is fixed or percent in both directions and stayed
364 // that way in the new style. Therefore all we are doing is moving. 364 // that way in the new style. Therefore all we are doing is moving.
365 return true; 365 return true;
366 } 366 }
367 367
368 StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon textSensitiveProperties) const 368 StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon textSensitiveProperties) const
369 { 369 {
370 changedContextSensitiveProperties = ContextSensitivePropertyNone; 370 changedContextSensitiveProperties = ContextSensitivePropertyNone;
371 371
372 // Note, we use .get() on each DataRef below because DataRef::operator== wil l do a deep
373 // compare, which is duplicate work when we're going to compare each propert y inside
374 // this function anyway.
375
372 StyleDifference svgChange = StyleDifferenceEqual; 376 StyleDifference svgChange = StyleDifferenceEqual;
373 if (m_svgStyle != other->m_svgStyle) { 377 if (m_svgStyle.get() != other->m_svgStyle.get()) {
374 svgChange = m_svgStyle->diff(other->m_svgStyle.get()); 378 svgChange = m_svgStyle->diff(other->m_svgStyle.get());
375 if (svgChange == StyleDifferenceLayout) 379 if (svgChange == StyleDifferenceLayout)
376 return svgChange; 380 return svgChange;
377 } 381 }
378 382
379 if (m_box->width() != other->m_box->width() 383 if (m_box.get() != other->m_box.get()) {
380 || m_box->minWidth() != other->m_box->minWidth() 384 if (m_box->width() != other->m_box->width()
381 || m_box->maxWidth() != other->m_box->maxWidth() 385 || m_box->minWidth() != other->m_box->minWidth()
382 || m_box->height() != other->m_box->height() 386 || m_box->maxWidth() != other->m_box->maxWidth()
383 || m_box->minHeight() != other->m_box->minHeight() 387 || m_box->height() != other->m_box->height()
384 || m_box->maxHeight() != other->m_box->maxHeight()) 388 || m_box->minHeight() != other->m_box->minHeight()
385 return StyleDifferenceLayout; 389 || m_box->maxHeight() != other->m_box->maxHeight())
390 return StyleDifferenceLayout;
386 391
387 if (m_box->verticalAlign() != other->m_box->verticalAlign() || noninherited_ flags._vertical_align != other->noninherited_flags._vertical_align) 392 if (m_box->verticalAlign() != other->m_box->verticalAlign())
388 return StyleDifferenceLayout; 393 return StyleDifferenceLayout;
389 394
390 if (m_box->boxSizing() != other->m_box->boxSizing()) 395 if (m_box->boxSizing() != other->m_box->boxSizing())
391 return StyleDifferenceLayout; 396 return StyleDifferenceLayout;
397 }
392 398
393 if (surround->margin != other->surround->margin) 399 if (surround.get() != other->surround.get()) {
394 return StyleDifferenceLayout; 400 if (surround->margin != other->surround->margin)
401 return StyleDifferenceLayout;
395 402
396 if (surround->padding != other->surround->padding) 403 if (surround->padding != other->surround->padding)
397 return StyleDifferenceLayout; 404 return StyleDifferenceLayout;
405
406 // If our border widths change, then we need to layout. Other changes to borders only necessitate a repaint.
407 if (borderLeftWidth() != other->borderLeftWidth()
408 || borderTopWidth() != other->borderTopWidth()
409 || borderBottomWidth() != other->borderBottomWidth()
410 || borderRightWidth() != other->borderRightWidth())
411 return StyleDifferenceLayout;
412 }
398 413
399 if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) { 414 if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
400 if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m _appearance 415 if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m _appearance
401 || rareNonInheritedData->marginBeforeCollapse != other->rareNonInher itedData->marginBeforeCollapse 416 || rareNonInheritedData->marginBeforeCollapse != other->rareNonInher itedData->marginBeforeCollapse
402 || rareNonInheritedData->marginAfterCollapse != other->rareNonInheri tedData->marginAfterCollapse 417 || rareNonInheritedData->marginAfterCollapse != other->rareNonInheri tedData->marginAfterCollapse
403 || rareNonInheritedData->lineClamp != other->rareNonInheritedData->l ineClamp 418 || rareNonInheritedData->lineClamp != other->rareNonInheritedData->l ineClamp
404 || rareNonInheritedData->textOverflow != other->rareNonInheritedData ->textOverflow) 419 || rareNonInheritedData->textOverflow != other->rareNonInheritedData ->textOverflow
405 return StyleDifferenceLayout; 420 || rareNonInheritedData->m_regionFragment != other->rareNonInherited Data->m_regionFragment
406 421 || rareNonInheritedData->m_wrapFlow != other->rareNonInheritedData-> m_wrapFlow
407 if (rareNonInheritedData->m_regionFragment != other->rareNonInheritedDat a->m_regionFragment)
408 return StyleDifferenceLayout;
409
410 if (rareNonInheritedData->m_wrapFlow != other->rareNonInheritedData->m_w rapFlow
411 || rareNonInheritedData->m_wrapThrough != other->rareNonInheritedDat a->m_wrapThrough 422 || rareNonInheritedData->m_wrapThrough != other->rareNonInheritedDat a->m_wrapThrough
412 || rareNonInheritedData->m_shapeMargin != other->rareNonInheritedDat a->m_shapeMargin 423 || rareNonInheritedData->m_shapeMargin != other->rareNonInheritedDat a->m_shapeMargin
413 || rareNonInheritedData->m_shapePadding != other->rareNonInheritedDa ta->m_shapePadding) 424 || rareNonInheritedData->m_shapePadding != other->rareNonInheritedDa ta->m_shapePadding
425 || rareNonInheritedData->m_order != other->rareNonInheritedData->m_o rder
426 || rareNonInheritedData->m_alignContent != other->rareNonInheritedDa ta->m_alignContent
427 || rareNonInheritedData->m_alignItems != other->rareNonInheritedData ->m_alignItems
428 || rareNonInheritedData->m_alignSelf != other->rareNonInheritedData- >m_alignSelf
429 || rareNonInheritedData->m_justifyContent != other->rareNonInherited Data->m_justifyContent
430 || rareNonInheritedData->m_grid.get() != other->rareNonInheritedData ->m_grid.get()
431 || rareNonInheritedData->m_gridItem.get() != other->rareNonInherited Data->m_gridItem.get()
432 || rareNonInheritedData->m_shapeInside != other->rareNonInheritedDat a->m_shapeInside
433 || rareNonInheritedData->m_textCombine != other->rareNonInheritedDat a->m_textCombine
434 || rareNonInheritedData->hasFilters() != other->rareNonInheritedData ->hasFilters())
414 return StyleDifferenceLayout; 435 return StyleDifferenceLayout;
415 436
416 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNo nInheritedData->m_deprecatedFlexibleBox.get() 437 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNo nInheritedData->m_deprecatedFlexibleBox.get()
417 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->r areNonInheritedData->m_deprecatedFlexibleBox.get()) 438 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->r areNonInheritedData->m_deprecatedFlexibleBox.get())
418 return StyleDifferenceLayout; 439 return StyleDifferenceLayout;
419 440
420 if (rareNonInheritedData->m_flexibleBox.get() != other->rareNonInherited Data->m_flexibleBox.get() 441 if (rareNonInheritedData->m_flexibleBox.get() != other->rareNonInherited Data->m_flexibleBox.get()
421 && *rareNonInheritedData->m_flexibleBox.get() != *other->rareNonInhe ritedData->m_flexibleBox.get()) 442 && *rareNonInheritedData->m_flexibleBox.get() != *other->rareNonInhe ritedData->m_flexibleBox.get())
422 return StyleDifferenceLayout; 443 return StyleDifferenceLayout;
423 if (rareNonInheritedData->m_order != other->rareNonInheritedData->m_orde r
424 || rareNonInheritedData->m_alignContent != other->rareNonInheritedDa ta->m_alignContent
425 || rareNonInheritedData->m_alignItems != other->rareNonInheritedData ->m_alignItems
426 || rareNonInheritedData->m_alignSelf != other->rareNonInheritedData- >m_alignSelf
427 || rareNonInheritedData->m_justifyContent != other->rareNonInherited Data->m_justifyContent)
428 return StyleDifferenceLayout;
429 444
430 // FIXME: We should add an optimized form of layout that just recomputes visual overflow. 445 // FIXME: We should add an optimized form of layout that just recomputes visual overflow.
431 if (!rareNonInheritedData->shadowDataEquivalent(*other->rareNonInherited Data.get())) 446 if (!rareNonInheritedData->shadowDataEquivalent(*other->rareNonInherited Data.get()))
432 return StyleDifferenceLayout; 447 return StyleDifferenceLayout;
433 448
434 if (!rareNonInheritedData->reflectionDataEquivalent(*other->rareNonInher itedData.get())) 449 if (!rareNonInheritedData->reflectionDataEquivalent(*other->rareNonInher itedData.get()))
435 return StyleDifferenceLayout; 450 return StyleDifferenceLayout;
436 451
437 if (rareNonInheritedData->m_multiCol.get() != other->rareNonInheritedDat a->m_multiCol.get() 452 if (rareNonInheritedData->m_multiCol.get() != other->rareNonInheritedDat a->m_multiCol.get()
438 && *rareNonInheritedData->m_multiCol.get() != *other->rareNonInherit edData->m_multiCol.get()) 453 && *rareNonInheritedData->m_multiCol.get() != *other->rareNonInherit edData->m_multiCol.get())
439 return StyleDifferenceLayout; 454 return StyleDifferenceLayout;
440 455
441 if (rareNonInheritedData->m_transform.get() != other->rareNonInheritedDa ta->m_transform.get() 456 if (rareNonInheritedData->m_transform.get() != other->rareNonInheritedDa ta->m_transform.get()
442 && *rareNonInheritedData->m_transform.get() != *other->rareNonInheri tedData->m_transform.get()) { 457 && *rareNonInheritedData->m_transform.get() != *other->rareNonInheri tedData->m_transform.get()) {
443 // Don't return early here; instead take note of the type of 458 // Don't return early here; instead take note of the type of
444 // change, and deal with it when looking at compositing. 459 // change, and deal with it when looking at compositing.
445 changedContextSensitiveProperties |= ContextSensitivePropertyTransfo rm; 460 changedContextSensitiveProperties |= ContextSensitivePropertyTransfo rm;
446 } 461 }
447 462
448 if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m _grid.get() 463 // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
449 || rareNonInheritedData->m_gridItem.get() != other->rareNonInherited Data->m_gridItem.get()) 464 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti ves.get();
465 const CounterDirectiveMap* mapB = other->rareNonInheritedData->m_counter Directives.get();
466 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
450 return StyleDifferenceLayout; 467 return StyleDifferenceLayout;
451 468
452 if (rareNonInheritedData->m_shapeInside != other->rareNonInheritedData-> m_shapeInside) 469 // We only need do layout for opacity changes if adding or losing opacit y could trigger a change
470 // in us being a stacking context.
471 if (hasAutoZIndex() != other->hasAutoZIndex() && rareNonInheritedData->h asOpacity() != other->rareNonInheritedData->hasOpacity()) {
472 // FIXME: We would like to use SimplifiedLayout here, but we can't q uite do that yet.
473 // We need to make sure SimplifiedLayout can operate correctly on Re nderInlines (we will need
474 // to add a selfNeedsSimplifiedLayout bit in order to not get confus ed and taint every line).
475 // In addition we need to solve the floating object issue when layer s come and go. Right now
476 // a full layout is necessary to keep floating object lists sane.
453 return StyleDifferenceLayout; 477 return StyleDifferenceLayout;
478 }
454 } 479 }
455 480
456 if (rareInheritedData.get() != other->rareInheritedData.get()) { 481 if (rareInheritedData.get() != other->rareInheritedData.get()) {
457 if (rareInheritedData->highlight != other->rareInheritedData->highlight 482 if (rareInheritedData->highlight != other->rareInheritedData->highlight
458 || rareInheritedData->indent != other->rareInheritedData->indent 483 || rareInheritedData->indent != other->rareInheritedData->indent
459 || rareInheritedData->m_textAlignLast != other->rareInheritedData->m _textAlignLast 484 || rareInheritedData->m_textAlignLast != other->rareInheritedData->m _textAlignLast
460 || rareInheritedData->m_textIndentLine != other->rareInheritedData-> m_textIndentLine 485 || rareInheritedData->m_textIndentLine != other->rareInheritedData-> m_textIndentLine
461 || rareInheritedData->m_effectiveZoom != other->rareInheritedData->m _effectiveZoom 486 || rareInheritedData->m_effectiveZoom != other->rareInheritedData->m _effectiveZoom
462 || rareInheritedData->wordBreak != other->rareInheritedData->wordBre ak 487 || rareInheritedData->wordBreak != other->rareInheritedData->wordBre ak
463 || rareInheritedData->overflowWrap != other->rareInheritedData->over flowWrap 488 || rareInheritedData->overflowWrap != other->rareInheritedData->over flowWrap
464 || rareInheritedData->lineBreak != other->rareInheritedData->lineBre ak 489 || rareInheritedData->lineBreak != other->rareInheritedData->lineBre ak
465 || rareInheritedData->textSecurity != other->rareInheritedData->text Security 490 || rareInheritedData->textSecurity != other->rareInheritedData->text Security
466 || rareInheritedData->hyphens != other->rareInheritedData->hyphens 491 || rareInheritedData->hyphens != other->rareInheritedData->hyphens
467 || rareInheritedData->hyphenationLimitBefore != other->rareInherited Data->hyphenationLimitBefore 492 || rareInheritedData->hyphenationLimitBefore != other->rareInherited Data->hyphenationLimitBefore
468 || rareInheritedData->hyphenationLimitAfter != other->rareInheritedD ata->hyphenationLimitAfter 493 || rareInheritedData->hyphenationLimitAfter != other->rareInheritedD ata->hyphenationLimitAfter
469 || rareInheritedData->hyphenationString != other->rareInheritedData- >hyphenationString 494 || rareInheritedData->hyphenationString != other->rareInheritedData- >hyphenationString
470 || rareInheritedData->locale != other->rareInheritedData->locale 495 || rareInheritedData->locale != other->rareInheritedData->locale
471 || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_ rubyPosition 496 || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_ rubyPosition
472 || rareInheritedData->textEmphasisMark != other->rareInheritedData-> textEmphasisMark 497 || rareInheritedData->textEmphasisMark != other->rareInheritedData-> textEmphasisMark
473 || rareInheritedData->textEmphasisPosition != other->rareInheritedDa ta->textEmphasisPosition 498 || rareInheritedData->textEmphasisPosition != other->rareInheritedDa ta->textEmphasisPosition
474 || rareInheritedData->textEmphasisCustomMark != other->rareInherited Data->textEmphasisCustomMark 499 || rareInheritedData->textEmphasisCustomMark != other->rareInherited Data->textEmphasisCustomMark
475 || rareInheritedData->m_textAlignLast != other->rareInheritedData->m _textAlignLast 500 || rareInheritedData->m_textAlignLast != other->rareInheritedData->m _textAlignLast
476 || rareInheritedData->m_textJustify != other->rareInheritedData->m_t extJustify 501 || rareInheritedData->m_textJustify != other->rareInheritedData->m_t extJustify
477 || rareInheritedData->m_textOrientation != other->rareInheritedData- >m_textOrientation 502 || rareInheritedData->m_textOrientation != other->rareInheritedData- >m_textOrientation
478 || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSi ze 503 || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSi ze
479 || rareInheritedData->m_lineBoxContain != other->rareInheritedData-> m_lineBoxContain 504 || rareInheritedData->m_lineBoxContain != other->rareInheritedData-> m_lineBoxContain
480 || rareInheritedData->m_lineGrid != other->rareInheritedData->m_line Grid 505 || rareInheritedData->m_lineGrid != other->rareInheritedData->m_line Grid
481 || rareInheritedData->m_lineSnap != other->rareInheritedData->m_line Snap 506 || rareInheritedData->m_lineSnap != other->rareInheritedData->m_line Snap
482 || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lin eAlign 507 || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lin eAlign
483 || rareInheritedData->listStyleImage != other->rareInheritedData->li stStyleImage) 508 || rareInheritedData->listStyleImage != other->rareInheritedData->li stStyleImage
509 || rareInheritedData->textStrokeWidth != other->rareInheritedData->t extStrokeWidth)
484 return StyleDifferenceLayout; 510 return StyleDifferenceLayout;
485 511
486 if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.g et())) 512 if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.g et()))
487 return StyleDifferenceLayout; 513 return StyleDifferenceLayout;
488 514
489 if (textStrokeWidth() != other->textStrokeWidth()) 515 if (!QuotesData::equals(rareInheritedData->quotes.get(), other->rareInhe ritedData->quotes.get()))
490 return StyleDifferenceLayout; 516 return StyleDifferenceLayout;
491 } 517 }
492 518
493 if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMul tiplier) 519 if (visual->m_textAutosizingMultiplier != other->visual->m_textAutosizingMul tiplier)
494 return StyleDifferenceLayout; 520 return StyleDifferenceLayout;
495 521
496 if (inherited->line_height != other->inherited->line_height 522 if (inherited.get() != other->inherited.get()) {
523 if (inherited->line_height != other->inherited->line_height
497 || inherited->font != other->inherited->font 524 || inherited->font != other->inherited->font
498 || inherited->horizontal_border_spacing != other->inherited->horizontal_ border_spacing 525 || inherited->horizontal_border_spacing != other->inherited->horizontal_ border_spacing
499 || inherited->vertical_border_spacing != other->inherited->vertical_bord er_spacing 526 || inherited->vertical_border_spacing != other->inherited->vertical_bord er_spacing)
500 || inherited_flags._box_direction != other->inherited_flags._box_directi on 527 return StyleDifferenceLayout;
528 }
529
530 if (inherited_flags._box_direction != other->inherited_flags._box_direction
501 || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering 531 || inherited_flags.m_rtlOrdering != other->inherited_flags.m_rtlOrdering
532 || inherited_flags._text_align != other->inherited_flags._text_align
533 || inherited_flags._text_transform != other->inherited_flags._text_trans form
534 || inherited_flags._direction != other->inherited_flags._direction
535 || inherited_flags._white_space != other->inherited_flags._white_space
536 || inherited_flags.m_writingMode != other->inherited_flags.m_writingMode )
537 return StyleDifferenceLayout;
538
539 if (noninherited_flags._overflowX != other->noninherited_flags._overflowX
540 || noninherited_flags._overflowY != other->noninherited_flags._overflowY
541 || noninherited_flags._clear != other->noninherited_flags._clear
542 || noninherited_flags._unicodeBidi != other->noninherited_flags._unicode Bidi
502 || noninherited_flags._position != other->noninherited_flags._position 543 || noninherited_flags._position != other->noninherited_flags._position
503 || noninherited_flags._floating != other->noninherited_flags._floating 544 || noninherited_flags._floating != other->noninherited_flags._floating
504 || noninherited_flags._originalDisplay != other->noninherited_flags._ori ginalDisplay) 545 || noninherited_flags._originalDisplay != other->noninherited_flags._ori ginalDisplay
546 || noninherited_flags._vertical_align != other->noninherited_flags._vert ical_align)
505 return StyleDifferenceLayout; 547 return StyleDifferenceLayout;
506 548
507 549 if (noninherited_flags._effectiveDisplay >= FIRST_TABLE_DISPLAY && noninheri ted_flags._effectiveDisplay <= LAST_TABLE_DISPLAY) {
508 if (((int)noninherited_flags._effectiveDisplay) >= TABLE) {
509 if (inherited_flags._border_collapse != other->inherited_flags._border_c ollapse 550 if (inherited_flags._border_collapse != other->inherited_flags._border_c ollapse
510 || inherited_flags._empty_cells != other->inherited_flags._empty_cel ls 551 || inherited_flags._empty_cells != other->inherited_flags._empty_cel ls
511 || inherited_flags._caption_side != other->inherited_flags._caption_ side 552 || inherited_flags._caption_side != other->inherited_flags._caption_ side
512 || noninherited_flags._table_layout != other->noninherited_flags._ta ble_layout) 553 || noninherited_flags._table_layout != other->noninherited_flags._ta ble_layout)
513 return StyleDifferenceLayout; 554 return StyleDifferenceLayout;
514 555
515 // In the collapsing border model, 'hidden' suppresses other borders, wh ile 'none' 556 // In the collapsing border model, 'hidden' suppresses other borders, wh ile 'none'
516 // does not, so these style differences can be width differences. 557 // does not, so these style differences can be width differences.
517 if (inherited_flags._border_collapse 558 if (inherited_flags._border_collapse
518 && ((borderTopStyle() == BHIDDEN && other->borderTopStyle() == BNONE ) 559 && ((borderTopStyle() == BHIDDEN && other->borderTopStyle() == BNONE )
519 || (borderTopStyle() == BNONE && other->borderTopStyle() == BHID DEN) 560 || (borderTopStyle() == BNONE && other->borderTopStyle() == BHID DEN)
520 || (borderBottomStyle() == BHIDDEN && other->borderBottomStyle() == BNONE) 561 || (borderBottomStyle() == BHIDDEN && other->borderBottomStyle() == BNONE)
521 || (borderBottomStyle() == BNONE && other->borderBottomStyle() = = BHIDDEN) 562 || (borderBottomStyle() == BNONE && other->borderBottomStyle() = = BHIDDEN)
522 || (borderLeftStyle() == BHIDDEN && other->borderLeftStyle() == BNONE) 563 || (borderLeftStyle() == BHIDDEN && other->borderLeftStyle() == BNONE)
523 || (borderLeftStyle() == BNONE && other->borderLeftStyle() == BH IDDEN) 564 || (borderLeftStyle() == BNONE && other->borderLeftStyle() == BH IDDEN)
524 || (borderRightStyle() == BHIDDEN && other->borderRightStyle() = = BNONE) 565 || (borderRightStyle() == BHIDDEN && other->borderRightStyle() = = BNONE)
525 || (borderRightStyle() == BNONE && other->borderRightStyle() == BHIDDEN))) 566 || (borderRightStyle() == BNONE && other->borderRightStyle() == BHIDDEN)))
526 return StyleDifferenceLayout; 567 return StyleDifferenceLayout;
527 } 568 } else if (noninherited_flags._effectiveDisplay == LIST_ITEM) {
528
529 if (noninherited_flags._effectiveDisplay == LIST_ITEM) {
530 if (inherited_flags._list_style_type != other->inherited_flags._list_sty le_type 569 if (inherited_flags._list_style_type != other->inherited_flags._list_sty le_type
531 || inherited_flags._list_style_position != other->inherited_flags._l ist_style_position) 570 || inherited_flags._list_style_position != other->inherited_flags._l ist_style_position)
532 return StyleDifferenceLayout; 571 return StyleDifferenceLayout;
533 } 572 }
534 573
535 if (inherited_flags._text_align != other->inherited_flags._text_align
536 || inherited_flags._text_transform != other->inherited_flags._text_trans form
537 || inherited_flags._direction != other->inherited_flags._direction
538 || inherited_flags._white_space != other->inherited_flags._white_space
539 || noninherited_flags._clear != other->noninherited_flags._clear
540 || noninherited_flags._unicodeBidi != other->noninherited_flags._unicode Bidi)
541 return StyleDifferenceLayout;
542
543 // Check block flow direction.
544 if (inherited_flags.m_writingMode != other->inherited_flags.m_writingMode)
545 return StyleDifferenceLayout;
546
547 // Check text combine mode.
548 if (rareNonInheritedData->m_textCombine != other->rareNonInheritedData->m_te xtCombine)
549 return StyleDifferenceLayout;
550
551 // Overflow returns a layout hint.
552 if (noninherited_flags._overflowX != other->noninherited_flags._overflowX
553 || noninherited_flags._overflowY != other->noninherited_flags._overflowY )
554 return StyleDifferenceLayout;
555
556 // If our border widths change, then we need to layout. Other changes to bo rders
557 // only necessitate a repaint.
558 if (borderLeftWidth() != other->borderLeftWidth()
559 || borderTopWidth() != other->borderTopWidth()
560 || borderBottomWidth() != other->borderBottomWidth()
561 || borderRightWidth() != other->borderRightWidth())
562 return StyleDifferenceLayout;
563
564 // If the counter directives change, trigger a relayout to re-calculate coun ter values and rebuild the counter node tree.
565 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives. get();
566 const CounterDirectiveMap* mapB = other->rareNonInheritedData->m_counterDire ctives.get();
567 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
568 return StyleDifferenceLayout;
569
570 if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE)) 574 if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
571 return StyleDifferenceLayout; 575 return StyleDifferenceLayout;
572 576
573 // We only need do layout for opacity changes if adding or losing opacity co uld trigger a change
574 // in us being a stacking context.
575 if (hasAutoZIndex() != other->hasAutoZIndex() && rareNonInheritedData->hasOp acity() != other->rareNonInheritedData->hasOpacity()) {
576 // FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
577 // We need to make sure SimplifiedLayout can operate correctly on Render Inlines (we will need
578 // to add a selfNeedsSimplifiedLayout bit in order to not get confused a nd taint every line).
579 // In addition we need to solve the floating object issue when layers co me and go. Right now
580 // a full layout is necessary to keep floating object lists sane.
581 return StyleDifferenceLayout;
582 }
583
584 if (rareNonInheritedData->hasFilters() != other->rareNonInheritedData->hasFi lters())
585 return StyleDifferenceLayout;
586
587 if (!QuotesData::equals(rareInheritedData->quotes.get(), other->rareInherite dData->quotes.get()))
588 return StyleDifferenceLayout;
589
590 // SVGRenderStyle::diff() might have returned StyleDifferenceRepaint, eg. if fill changes. 577 // SVGRenderStyle::diff() might have returned StyleDifferenceRepaint, eg. if fill changes.
591 // If eg. the font-size changed at the same time, we're not allowed to retur n StyleDifferenceRepaint, 578 // If eg. the font-size changed at the same time, we're not allowed to retur n StyleDifferenceRepaint,
592 // but have to return StyleDifferenceLayout, that's why this if branch come s after all branches 579 // but have to return StyleDifferenceLayout, that's why this if branch come s after all branches
593 // that are relevant for SVG and might return StyleDifferenceLayout. 580 // that are relevant for SVG and might return StyleDifferenceLayout.
594 if (svgChange != StyleDifferenceEqual) 581 if (svgChange != StyleDifferenceEqual)
595 return svgChange; 582 return svgChange;
596 583
597 // Make sure these left/top/right/bottom checks stay below all layout checks and above 584 // NOTE: This block must be last in this function for the StyleDifferenceLay outPositionedMovementOnly
598 // all visible checks. 585 // optimization to work properly.
599 if (position() != StaticPosition && surround->offset != other->surround->off set) { 586 if (position() != StaticPosition && surround->offset != other->surround->off set) {
600 // Optimize for the case where a positioned layer is moving but not chan ging size. 587 // Optimize for the case where a positioned layer is moving but not chan ging size.
601 if (position() == AbsolutePosition && positionedObjectMoved(surround->of fset, other->surround->offset, m_box->width()) && repaintOnlyDiff(other, changed ContextSensitiveProperties) == StyleDifferenceEqual) 588 if (position() == AbsolutePosition && positionedObjectMoved(surround->of fset, other->surround->offset, m_box->width()) && repaintOnlyDiff(other, changed ContextSensitiveProperties) == StyleDifferenceEqual)
602 return StyleDifferenceLayoutPositionedMovementOnly; 589 return StyleDifferenceLayoutPositionedMovementOnly;
603
604 // FIXME: We would like to use SimplifiedLayout for relative positioning , but we can't quite do that yet. 590 // FIXME: We would like to use SimplifiedLayout for relative positioning , but we can't quite do that yet.
605 // We need to make sure SimplifiedLayout can operate correctly on Render Inlines (we will need 591 // We need to make sure SimplifiedLayout can operate correctly on Render Inlines (we will need
606 // to add a selfNeedsSimplifiedLayout bit in order to not get confused a nd taint every line). 592 // to add a selfNeedsSimplifiedLayout bit in order to not get confused a nd taint every line).
607 return StyleDifferenceLayout; 593 return StyleDifferenceLayout;
608 } 594 }
595
609 return repaintOnlyDiff(other, changedContextSensitiveProperties); 596 return repaintOnlyDiff(other, changedContextSensitiveProperties);
610 } 597 }
611 598
612 StyleDifference RenderStyle::repaintOnlyDiff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const 599 StyleDifference RenderStyle::repaintOnlyDiff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
613 { 600 {
614 if (position() != StaticPosition && (m_box->zIndex() != other->m_box->zIndex () || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex() 601 if (position() != StaticPosition && (m_box->zIndex() != other->m_box->zIndex () || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex()
615 || visual->clip != other->visual->clip || visual->hasClip != other->visu al->hasClip)) 602 || visual->clip != other->visual->clip || visual->hasClip != other->visu al->hasClip))
616 return StyleDifferenceRepaintLayer; 603 return StyleDifferenceRepaintLayer;
617 604
618 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData ->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode 605 if (RuntimeEnabledFeatures::cssCompositingEnabled() && (rareNonInheritedData ->m_effectiveBlendMode != other->rareNonInheritedData->m_effectiveBlendMode
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 } 1591 }
1605 1592
1606 void RenderStyle::setBorderImageOutset(const BorderImageLengthBox& outset) 1593 void RenderStyle::setBorderImageOutset(const BorderImageLengthBox& outset)
1607 { 1594 {
1608 if (surround->border.m_image.outset() == outset) 1595 if (surround->border.m_image.outset() == outset)
1609 return; 1596 return;
1610 surround.access()->border.m_image.setOutset(outset); 1597 surround.access()->border.m_image.setOutset(outset);
1611 } 1598 }
1612 1599
1613 } // namespace WebCore 1600 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/style/RenderStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698