| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "platform/transforms/TranslateTransformOperation.h" | 54 #include "platform/transforms/TranslateTransformOperation.h" |
| 55 #include "wtf/MathExtras.h" | 55 #include "wtf/MathExtras.h" |
| 56 #include "wtf/PtrUtil.h" | 56 #include "wtf/PtrUtil.h" |
| 57 #include "wtf/SaturatedArithmetic.h" | 57 #include "wtf/SaturatedArithmetic.h" |
| 58 #include "wtf/SizeAssertions.h" | 58 #include "wtf/SizeAssertions.h" |
| 59 #include <algorithm> | 59 #include <algorithm> |
| 60 #include <memory> | 60 #include <memory> |
| 61 | 61 |
| 62 namespace blink { | 62 namespace blink { |
| 63 | 63 |
| 64 static const int kPaintOrderBitwidth = 2; |
| 65 |
| 64 struct SameSizeAsBorderValue { | 66 struct SameSizeAsBorderValue { |
| 65 RGBA32 m_color; | 67 RGBA32 m_color; |
| 66 unsigned m_bitfield; | 68 unsigned m_bitfield; |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 ASSERT_SIZE(BorderValue, SameSizeAsBorderValue); | 71 ASSERT_SIZE(BorderValue, SameSizeAsBorderValue); |
| 70 | 72 |
| 71 // Since different compilers/architectures pack ComputedStyle differently, | 73 // Since different compilers/architectures pack ComputedStyle differently, |
| 72 // re-create the same structure for an accurate size comparison. | 74 // re-create the same structure for an accurate size comparison. |
| 73 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { | 75 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 other.m_rareInheritedData->textStrokeWidth) | 780 other.m_rareInheritedData->textStrokeWidth) |
| 779 return true; | 781 return true; |
| 780 | 782 |
| 781 if (!m_rareInheritedData->shadowDataEquivalent( | 783 if (!m_rareInheritedData->shadowDataEquivalent( |
| 782 *other.m_rareInheritedData.get())) | 784 *other.m_rareInheritedData.get())) |
| 783 return true; | 785 return true; |
| 784 | 786 |
| 785 if (!m_rareInheritedData->quotesDataEquivalent( | 787 if (!m_rareInheritedData->quotesDataEquivalent( |
| 786 *other.m_rareInheritedData.get())) | 788 *other.m_rareInheritedData.get())) |
| 787 return true; | 789 return true; |
| 790 |
| 791 // These properties affect the cached stroke bounding box rects. |
| 792 if (m_rareInheritedData->capStyle != other.m_rareInheritedData->capStyle || |
| 793 m_rareInheritedData->joinStyle != |
| 794 other.m_rareInheritedData->joinStyle || |
| 795 m_rareInheritedData->strokeWidth != |
| 796 other.m_rareInheritedData->strokeWidth) |
| 797 return true; |
| 788 } | 798 } |
| 789 | 799 |
| 790 if (m_styleInheritedData->textAutosizingMultiplier != | 800 if (m_styleInheritedData->textAutosizingMultiplier != |
| 791 other.m_styleInheritedData->textAutosizingMultiplier) | 801 other.m_styleInheritedData->textAutosizingMultiplier) |
| 792 return true; | 802 return true; |
| 793 | 803 |
| 794 if (m_styleInheritedData->font.loadingCustomFonts() != | 804 if (m_styleInheritedData->font.loadingCustomFonts() != |
| 795 other.m_styleInheritedData->font.loadingCustomFonts()) | 805 other.m_styleInheritedData->font.loadingCustomFonts()) |
| 796 return true; | 806 return true; |
| 797 | 807 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 !m_surround->border.visuallyEqual(other.m_surround->border) || | 948 !m_surround->border.visuallyEqual(other.m_surround->border) || |
| 939 *m_background != *other.m_background) | 949 *m_background != *other.m_background) |
| 940 return true; | 950 return true; |
| 941 | 951 |
| 942 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { | 952 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { |
| 943 if (m_rareInheritedData->userModify != | 953 if (m_rareInheritedData->userModify != |
| 944 other.m_rareInheritedData->userModify || | 954 other.m_rareInheritedData->userModify || |
| 945 m_rareInheritedData->userSelect != | 955 m_rareInheritedData->userSelect != |
| 946 other.m_rareInheritedData->userSelect || | 956 other.m_rareInheritedData->userSelect || |
| 947 m_rareInheritedData->m_imageRendering != | 957 m_rareInheritedData->m_imageRendering != |
| 948 other.m_rareInheritedData->m_imageRendering) | 958 other.m_rareInheritedData->m_imageRendering || |
| 959 m_rareInheritedData->paintOrder != |
| 960 other.m_rareInheritedData->paintOrder) |
| 949 return true; | 961 return true; |
| 950 } | 962 } |
| 951 | 963 |
| 952 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { | 964 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
| 953 if (m_rareNonInheritedData->userDrag != | 965 if (m_rareNonInheritedData->userDrag != |
| 954 other.m_rareNonInheritedData->userDrag || | 966 other.m_rareNonInheritedData->userDrag || |
| 955 m_rareNonInheritedData->m_objectFit != | 967 m_rareNonInheritedData->m_objectFit != |
| 956 other.m_rareNonInheritedData->m_objectFit || | 968 other.m_rareNonInheritedData->m_objectFit || |
| 957 m_rareNonInheritedData->m_objectPosition != | 969 m_rareNonInheritedData->m_objectPosition != |
| 958 other.m_rareNonInheritedData->m_objectPosition || | 970 other.m_rareNonInheritedData->m_objectPosition || |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 bool ComputedStyle::shadowListHasCurrentColor(const ShadowList* shadowList) { | 2479 bool ComputedStyle::shadowListHasCurrentColor(const ShadowList* shadowList) { |
| 2468 if (!shadowList) | 2480 if (!shadowList) |
| 2469 return false; | 2481 return false; |
| 2470 for (size_t i = shadowList->shadows().size(); i--;) { | 2482 for (size_t i = shadowList->shadows().size(); i--;) { |
| 2471 if (shadowList->shadows()[i].color().isCurrentColor()) | 2483 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 2472 return true; | 2484 return true; |
| 2473 } | 2485 } |
| 2474 return false; | 2486 return false; |
| 2475 } | 2487 } |
| 2476 | 2488 |
| 2489 unsigned paintOrderSequence(EPaintOrderType first, |
| 2490 EPaintOrderType second, |
| 2491 EPaintOrderType third) { |
| 2492 return (((third << kPaintOrderBitwidth) | second) << kPaintOrderBitwidth) | |
| 2493 first; |
| 2494 } |
| 2495 |
| 2496 EPaintOrderType ComputedStyle::paintOrderType(unsigned index) const { |
| 2497 unsigned pt = 0; |
| 2498 DCHECK_LT(index, static_cast<unsigned>((1 << kPaintOrderBitwidth) - 1)); |
| 2499 switch (this->paintOrder()) { |
| 2500 case PaintOrderNormal: |
| 2501 case PaintOrderFillStrokeMarkers: |
| 2502 pt = paintOrderSequence(PT_FILL, PT_STROKE, PT_MARKERS); |
| 2503 break; |
| 2504 case PaintOrderFillMarkersStroke: |
| 2505 pt = paintOrderSequence(PT_FILL, PT_MARKERS, PT_STROKE); |
| 2506 break; |
| 2507 case PaintOrderStrokeFillMarkers: |
| 2508 pt = paintOrderSequence(PT_STROKE, PT_FILL, PT_MARKERS); |
| 2509 break; |
| 2510 case PaintOrderStrokeMarkersFill: |
| 2511 pt = paintOrderSequence(PT_STROKE, PT_MARKERS, PT_FILL); |
| 2512 break; |
| 2513 case PaintOrderMarkersFillStroke: |
| 2514 pt = paintOrderSequence(PT_MARKERS, PT_FILL, PT_STROKE); |
| 2515 break; |
| 2516 case PaintOrderMarkersStrokeFill: |
| 2517 pt = paintOrderSequence(PT_MARKERS, PT_STROKE, PT_FILL); |
| 2518 break; |
| 2519 } |
| 2520 |
| 2521 pt = |
| 2522 (pt >> (kPaintOrderBitwidth * index)) & ((1u << kPaintOrderBitwidth) - 1); |
| 2523 return (EPaintOrderType)pt; |
| 2524 } |
| 2525 |
| 2477 static inline Vector<GridTrackSize> initialGridAutoTracks() { | 2526 static inline Vector<GridTrackSize> initialGridAutoTracks() { |
| 2478 Vector<GridTrackSize> trackSizeList; | 2527 Vector<GridTrackSize> trackSizeList; |
| 2479 trackSizeList.reserveInitialCapacity(1); | 2528 trackSizeList.reserveInitialCapacity(1); |
| 2480 trackSizeList.uncheckedAppend(GridTrackSize(Length(Auto))); | 2529 trackSizeList.uncheckedAppend(GridTrackSize(Length(Auto))); |
| 2481 return trackSizeList; | 2530 return trackSizeList; |
| 2482 } | 2531 } |
| 2483 | 2532 |
| 2484 Vector<GridTrackSize> ComputedStyle::initialGridAutoColumns() { | 2533 Vector<GridTrackSize> ComputedStyle::initialGridAutoColumns() { |
| 2485 return initialGridAutoTracks(); | 2534 return initialGridAutoTracks(); |
| 2486 } | 2535 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2499 if (value < 0) | 2548 if (value < 0) |
| 2500 fvalue -= 0.5f; | 2549 fvalue -= 0.5f; |
| 2501 else | 2550 else |
| 2502 fvalue += 0.5f; | 2551 fvalue += 0.5f; |
| 2503 } | 2552 } |
| 2504 | 2553 |
| 2505 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2554 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2506 } | 2555 } |
| 2507 | 2556 |
| 2508 } // namespace blink | 2557 } // namespace blink |
| OLD | NEW |