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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2787183002: Rename members of StyleSurroundData and ComputedStyle. (Closed)
Patch Set: Rebase Created 3 years, 8 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
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 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if ((!diff.needsFullLayout() || !diff.needsFullPaintInvalidation()) && 525 if ((!diff.needsFullLayout() || !diff.needsFullPaintInvalidation()) &&
526 diffNeedsFullLayoutAndPaintInvalidation(other)) { 526 diffNeedsFullLayoutAndPaintInvalidation(other)) {
527 diff.setNeedsFullLayout(); 527 diff.setNeedsFullLayout();
528 diff.setNeedsPaintInvalidationObject(); 528 diff.setNeedsPaintInvalidationObject();
529 } 529 }
530 530
531 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) 531 if (!diff.needsFullLayout() && diffNeedsFullLayout(other))
532 diff.setNeedsFullLayout(); 532 diff.setNeedsFullLayout();
533 533
534 if (!diff.needsFullLayout() && 534 if (!diff.needsFullLayout() &&
535 m_surround->margin != other.m_surround->margin) { 535 m_surround->m_margin != other.m_surround->m_margin) {
536 // Relative-positioned elements collapse their margins so need a full 536 // Relative-positioned elements collapse their margins so need a full
537 // layout. 537 // layout.
538 if (hasOutOfFlowPosition()) 538 if (hasOutOfFlowPosition())
539 diff.setNeedsPositionedMovementLayout(); 539 diff.setNeedsPositionedMovementLayout();
540 else 540 else
541 diff.setNeedsFullLayout(); 541 diff.setNeedsFullLayout();
542 } 542 }
543 543
544 if (!diff.needsFullLayout() && position() != EPosition::kStatic && 544 if (!diff.needsFullLayout() && position() != EPosition::kStatic &&
545 !offsetEqual(other)) { 545 !offsetEqual(other)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 if (m_box->width() != other.m_box->width() || 587 if (m_box->width() != other.m_box->width() ||
588 m_box->minWidth() != other.m_box->minWidth() || 588 m_box->minWidth() != other.m_box->minWidth() ||
589 m_box->maxWidth() != other.m_box->maxWidth() || 589 m_box->maxWidth() != other.m_box->maxWidth() ||
590 m_box->height() != other.m_box->height() || 590 m_box->height() != other.m_box->height() ||
591 m_box->minHeight() != other.m_box->minHeight() || 591 m_box->minHeight() != other.m_box->minHeight() ||
592 m_box->maxHeight() != other.m_box->maxHeight()) 592 m_box->maxHeight() != other.m_box->maxHeight())
593 return true; 593 return true;
594 } 594 }
595 595
596 if (m_surround.get() != other.m_surround.get()) { 596 if (m_surround.get() != other.m_surround.get()) {
597 if (m_surround->margin != other.m_surround->margin || !offsetEqual(other) || 597 if (m_surround->m_margin != other.m_surround->m_margin ||
598 m_surround->padding != other.m_surround->padding) 598 !offsetEqual(other) ||
599 m_surround->m_padding != other.m_surround->m_padding)
599 return true; 600 return true;
600 } 601 }
601 602
602 if (diff.transformChanged()) 603 if (diff.transformChanged())
603 return true; 604 return true;
604 605
605 return false; 606 return false;
606 } 607 }
607 608
608 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation( 609 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(
609 const ComputedStyle& other) const { 610 const ComputedStyle& other) const {
610 // FIXME: Not all cases in this method need both full layout and paint 611 // FIXME: Not all cases in this method need both full layout and paint
611 // invalidation. 612 // invalidation.
612 // Should move cases into diffNeedsFullLayout() if 613 // Should move cases into diffNeedsFullLayout() if
613 // - don't need paint invalidation at all; 614 // - don't need paint invalidation at all;
614 // - or the layoutObject knows how to exactly invalidate paints caused by the 615 // - or the layoutObject knows how to exactly invalidate paints caused by the
615 // layout change instead of forced full paint invalidation. 616 // layout change instead of forced full paint invalidation.
616 617
617 if (m_surround.get() != other.m_surround.get()) { 618 if (m_surround.get() != other.m_surround.get()) {
618 // If our border widths change, then we need to layout. Other changes to 619 // If our border widths change, then we need to layout. Other changes to
619 // borders only necessitate a paint invalidation. 620 // borders only necessitate a paint invalidation.
620 if (borderLeftWidth() != other.borderLeftWidth() || 621 if (borderLeftWidth() != other.borderLeftWidth() ||
621 borderTopWidth() != other.borderTopWidth() || 622 borderTopWidth() != other.borderTopWidth() ||
622 borderBottomWidth() != other.borderBottomWidth() || 623 borderBottomWidth() != other.borderBottomWidth() ||
623 borderRightWidth() != other.borderRightWidth()) 624 borderRightWidth() != other.borderRightWidth())
624 return true; 625 return true;
625 626
626 if (m_surround->padding != other.m_surround->padding) 627 if (m_surround->m_padding != other.m_surround->m_padding)
627 return true; 628 return true;
628 } 629 }
629 630
630 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { 631 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) {
631 if (m_rareNonInheritedData->m_appearance != 632 if (m_rareNonInheritedData->m_appearance !=
632 other.m_rareNonInheritedData->m_appearance || 633 other.m_rareNonInheritedData->m_appearance ||
633 m_rareNonInheritedData->marginBeforeCollapse != 634 m_rareNonInheritedData->marginBeforeCollapse !=
634 other.m_rareNonInheritedData->marginBeforeCollapse || 635 other.m_rareNonInheritedData->marginBeforeCollapse ||
635 m_rareNonInheritedData->marginAfterCollapse != 636 m_rareNonInheritedData->marginAfterCollapse !=
636 other.m_rareNonInheritedData->marginAfterCollapse || 637 other.m_rareNonInheritedData->marginAfterCollapse ||
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 904 }
904 905
905 return false; 906 return false;
906 } 907 }
907 908
908 bool ComputedStyle::diffNeedsPaintInvalidationObject( 909 bool ComputedStyle::diffNeedsPaintInvalidationObject(
909 const ComputedStyle& other) const { 910 const ComputedStyle& other) const {
910 if (visibility() != other.visibility() || 911 if (visibility() != other.visibility() ||
911 printColorAdjust() != other.printColorAdjust() || 912 printColorAdjust() != other.printColorAdjust() ||
912 insideLink() != other.insideLink() || 913 insideLink() != other.insideLink() ||
913 !m_surround->border.visuallyEqual(other.m_surround->border) || 914 !m_surround->m_border.visuallyEqual(other.m_surround->m_border) ||
914 *m_background != *other.m_background) 915 *m_background != *other.m_background)
915 return true; 916 return true;
916 917
917 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { 918 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) {
918 if (m_rareInheritedData->userModify != 919 if (m_rareInheritedData->userModify !=
919 other.m_rareInheritedData->userModify || 920 other.m_rareInheritedData->userModify ||
920 m_rareInheritedData->userSelect != 921 m_rareInheritedData->userSelect !=
921 other.m_rareInheritedData->userSelect || 922 other.m_rareInheritedData->userSelect ||
922 m_rareInheritedData->m_imageRendering != 923 m_rareInheritedData->m_imageRendering !=
923 other.m_rareInheritedData->m_imageRendering) 924 other.m_rareInheritedData->m_imageRendering)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1052
1052 if (!m_rareNonInheritedData->reflectionDataEquivalent( 1053 if (!m_rareNonInheritedData->reflectionDataEquivalent(
1053 *other.m_rareNonInheritedData.get())) 1054 *other.m_rareNonInheritedData.get()))
1054 diff.setFilterChanged(); 1055 diff.setFilterChanged();
1055 1056
1056 if (!m_rareNonInheritedData->m_outline.visuallyEqual( 1057 if (!m_rareNonInheritedData->m_outline.visuallyEqual(
1057 other.m_rareNonInheritedData->m_outline)) 1058 other.m_rareNonInheritedData->m_outline))
1058 diff.setNeedsRecomputeOverflow(); 1059 diff.setNeedsRecomputeOverflow();
1059 } 1060 }
1060 1061
1061 if (!m_surround->border.visualOverflowEqual(other.m_surround->border)) 1062 if (!m_surround->m_border.visualOverflowEqual(other.m_surround->m_border))
1062 diff.setNeedsRecomputeOverflow(); 1063 diff.setNeedsRecomputeOverflow();
1063 1064
1064 if (!diff.needsFullPaintInvalidation()) { 1065 if (!diff.needsFullPaintInvalidation()) {
1065 if (m_styleInheritedData->color != other.m_styleInheritedData->color || 1066 if (m_styleInheritedData->color != other.m_styleInheritedData->color ||
1066 m_styleInheritedData->visitedLinkColor != 1067 m_styleInheritedData->visitedLinkColor !=
1067 other.m_styleInheritedData->visitedLinkColor || 1068 other.m_styleInheritedData->visitedLinkColor ||
1068 m_hasSimpleUnderline != other.m_hasSimpleUnderline || 1069 m_hasSimpleUnderline != other.m_hasSimpleUnderline ||
1069 m_visual->textDecoration != other.m_visual->textDecoration) { 1070 m_visual->textDecoration != other.m_visual->textDecoration) {
1070 diff.setTextDecorationOrColorChanged(); 1071 diff.setTextDecorationOrColorChanged();
1071 } else if (m_rareNonInheritedData.get() != 1072 } else if (m_rareNonInheritedData.get() !=
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 SET_VAR(m_styleInheritedData, vertical_border_spacing, v); 1464 SET_VAR(m_styleInheritedData, vertical_border_spacing, v);
1464 } 1465 }
1465 1466
1466 FloatRoundedRect ComputedStyle::getRoundedBorderFor( 1467 FloatRoundedRect ComputedStyle::getRoundedBorderFor(
1467 const LayoutRect& borderRect, 1468 const LayoutRect& borderRect,
1468 bool includeLogicalLeftEdge, 1469 bool includeLogicalLeftEdge,
1469 bool includeLogicalRightEdge) const { 1470 bool includeLogicalRightEdge) const {
1470 FloatRoundedRect roundedRect(pixelSnappedIntRect(borderRect)); 1471 FloatRoundedRect roundedRect(pixelSnappedIntRect(borderRect));
1471 if (hasBorderRadius()) { 1472 if (hasBorderRadius()) {
1472 FloatRoundedRect::Radii radii = 1473 FloatRoundedRect::Radii radii =
1473 calcRadiiFor(m_surround->border, borderRect.size()); 1474 calcRadiiFor(m_surround->m_border, borderRect.size());
1474 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), 1475 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(),
1475 includeLogicalLeftEdge, 1476 includeLogicalLeftEdge,
1476 includeLogicalRightEdge); 1477 includeLogicalRightEdge);
1477 roundedRect.constrainRadii(); 1478 roundedRect.constrainRadii();
1478 } 1479 }
1479 return roundedRect; 1480 return roundedRect;
1480 } 1481 }
1481 1482
1482 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor( 1483 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor(
1483 const LayoutRect& borderRect, 1484 const LayoutRect& borderRect,
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 const NinePieceImage& image) const { 2375 const NinePieceImage& image) const {
2375 return LayoutRectOutsets( 2376 return LayoutRectOutsets(
2376 NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), 2377 NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()),
2377 NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()), 2378 NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()),
2378 NinePieceImage::computeOutset(image.outset().bottom(), 2379 NinePieceImage::computeOutset(image.outset().bottom(),
2379 borderBottomWidth()), 2380 borderBottomWidth()),
2380 NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth())); 2381 NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()));
2381 } 2382 }
2382 2383
2383 void ComputedStyle::setBorderImageSource(StyleImage* image) { 2384 void ComputedStyle::setBorderImageSource(StyleImage* image) {
2384 if (m_surround->border.m_image.image() == image) 2385 if (m_surround->m_border.m_image.image() == image)
2385 return; 2386 return;
2386 m_surround.access()->border.m_image.setImage(image); 2387 m_surround.access()->m_border.m_image.setImage(image);
2387 } 2388 }
2388 2389
2389 void ComputedStyle::setBorderImageSlices(const LengthBox& slices) { 2390 void ComputedStyle::setBorderImageSlices(const LengthBox& slices) {
2390 if (m_surround->border.m_image.imageSlices() == slices) 2391 if (m_surround->m_border.m_image.imageSlices() == slices)
2391 return; 2392 return;
2392 m_surround.access()->border.m_image.setImageSlices(slices); 2393 m_surround.access()->m_border.m_image.setImageSlices(slices);
2393 } 2394 }
2394 2395
2395 void ComputedStyle::setBorderImageSlicesFill(bool fill) { 2396 void ComputedStyle::setBorderImageSlicesFill(bool fill) {
2396 if (m_surround->border.m_image.fill() == fill) 2397 if (m_surround->m_border.m_image.fill() == fill)
2397 return; 2398 return;
2398 m_surround.access()->border.m_image.setFill(fill); 2399 m_surround.access()->m_border.m_image.setFill(fill);
2399 } 2400 }
2400 2401
2401 void ComputedStyle::setBorderImageWidth(const BorderImageLengthBox& slices) { 2402 void ComputedStyle::setBorderImageWidth(const BorderImageLengthBox& slices) {
2402 if (m_surround->border.m_image.borderSlices() == slices) 2403 if (m_surround->m_border.m_image.borderSlices() == slices)
2403 return; 2404 return;
2404 m_surround.access()->border.m_image.setBorderSlices(slices); 2405 m_surround.access()->m_border.m_image.setBorderSlices(slices);
2405 } 2406 }
2406 2407
2407 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) { 2408 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) {
2408 if (m_surround->border.m_image.outset() == outset) 2409 if (m_surround->m_border.m_image.outset() == outset)
2409 return; 2410 return;
2410 m_surround.access()->border.m_image.setOutset(outset); 2411 m_surround.access()->m_border.m_image.setOutset(outset);
2411 } 2412 }
2412 2413
2413 bool ComputedStyle::borderObscuresBackground() const { 2414 bool ComputedStyle::borderObscuresBackground() const {
2414 if (!hasBorder()) 2415 if (!hasBorder())
2415 return false; 2416 return false;
2416 2417
2417 // Bail if we have any border-image for now. We could look at the image alpha 2418 // Bail if we have any border-image for now. We could look at the image alpha
2418 // to improve this. 2419 // to improve this.
2419 if (borderImage().image()) 2420 if (borderImage().image())
2420 return false; 2421 return false;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 if (value < 0) 2495 if (value < 0)
2495 fvalue -= 0.5f; 2496 fvalue -= 0.5f;
2496 else 2497 else
2497 fvalue += 0.5f; 2498 fvalue += 0.5f;
2498 } 2499 }
2499 2500
2500 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2501 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2501 } 2502 }
2502 2503
2503 } // namespace blink 2504 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleSurroundData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698