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

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

Issue 2481553002: Move outline out of StyleBackgroundData into StyleRareNonInheritedData (Closed)
Patch Set: - Created 4 years, 1 month 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 // We restrict the smallest value to int min + 2 because we use int min and 1499 // We restrict the smallest value to int min + 2 because we use int min and
1500 // int min + 1 as special values in a hash set. 1500 // int min + 1 as special values in a hash set.
1501 void setOrder(int o) { 1501 void setOrder(int o) {
1502 SET_VAR(m_rareNonInheritedData, m_order, 1502 SET_VAR(m_rareNonInheritedData, m_order,
1503 max(std::numeric_limits<int>::min() + 2, o)); 1503 max(std::numeric_limits<int>::min() + 2, o));
1504 } 1504 }
1505 1505
1506 // Outline properties. 1506 // Outline properties.
1507 // outline-color 1507 // outline-color
1508 void setOutlineColor(const StyleColor& v) { 1508 void setOutlineColor(const StyleColor& v) {
1509 SET_BORDERVALUE_COLOR(m_background, m_outline, v); 1509 SET_BORDERVALUE_COLOR(m_rareNonInheritedData, m_outline, v);
1510 } 1510 }
1511 1511
1512 // outline-style 1512 // outline-style
1513 EBorderStyle outlineStyle() const { return m_background->outline().style(); } 1513 EBorderStyle outlineStyle() const {
1514 return m_rareNonInheritedData->m_outline.style();
1515 }
1514 void setOutlineStyle(EBorderStyle v) { 1516 void setOutlineStyle(EBorderStyle v) {
1515 SET_VAR(m_background, m_outline.m_style, v); 1517 SET_VAR(m_rareNonInheritedData, m_outline.m_style, v);
1516 } 1518 }
1517 static OutlineIsAuto initialOutlineStyleIsAuto() { return OutlineIsAutoOff; } 1519 static OutlineIsAuto initialOutlineStyleIsAuto() { return OutlineIsAutoOff; }
1518 OutlineIsAuto outlineStyleIsAuto() const { 1520 OutlineIsAuto outlineStyleIsAuto() const {
1519 return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); 1521 return static_cast<OutlineIsAuto>(
1522 m_rareNonInheritedData->m_outline.isAuto());
1520 } 1523 }
1521 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { 1524 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) {
1522 SET_VAR(m_background, m_outline.m_isAuto, isAuto); 1525 SET_VAR(m_rareNonInheritedData, m_outline.m_isAuto, isAuto);
1523 } 1526 }
1524 1527
1525 // outline-width 1528 // outline-width
1526 static unsigned short initialOutlineWidth() { return 3; } 1529 static unsigned short initialOutlineWidth() { return 3; }
1527 int outlineWidth() const { 1530 int outlineWidth() const {
1528 if (m_background->outline().style() == BorderStyleNone) 1531 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone)
1529 return 0; 1532 return 0;
1530 return m_background->outline().width(); 1533 return m_rareNonInheritedData->m_outline.width();
1531 } 1534 }
1532 void setOutlineWidth(unsigned short v) { 1535 void setOutlineWidth(unsigned short v) {
1533 SET_VAR(m_background, m_outline.m_width, v); 1536 SET_VAR(m_rareNonInheritedData, m_outline.m_width, v);
1534 } 1537 }
1535 1538
1536 // outline-offset 1539 // outline-offset
1537 static int initialOutlineOffset() { return 0; } 1540 static int initialOutlineOffset() { return 0; }
1538 int outlineOffset() const { 1541 int outlineOffset() const {
1539 if (m_background->outline().style() == BorderStyleNone) 1542 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone)
1540 return 0; 1543 return 0;
1541 return m_background->outline().offset(); 1544 return m_rareNonInheritedData->m_outline.offset();
1542 } 1545 }
1543 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); } 1546 void setOutlineOffset(int v) {
1547 SET_VAR(m_rareNonInheritedData, m_outline.m_offset, v);
1548 }
1544 1549
1545 // Overflow properties. 1550 // Overflow properties.
1546 // overflow-anchor 1551 // overflow-anchor
1547 static EOverflowAnchor initialOverflowAnchor() { return AnchorAuto; } 1552 static EOverflowAnchor initialOverflowAnchor() { return AnchorAuto; }
1548 EOverflowAnchor overflowAnchor() const { 1553 EOverflowAnchor overflowAnchor() const {
1549 return static_cast<EOverflowAnchor>(m_nonInheritedData.m_overflowAnchor); 1554 return static_cast<EOverflowAnchor>(m_nonInheritedData.m_overflowAnchor);
1550 } 1555 }
1551 void setOverflowAnchor(EOverflowAnchor v) { 1556 void setOverflowAnchor(EOverflowAnchor v) {
1552 m_nonInheritedData.m_overflowAnchor = v; 1557 m_nonInheritedData.m_overflowAnchor = v;
1553 } 1558 }
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
3462 // Page size utility functions. 3467 // Page size utility functions.
3463 void resetPageSizeType() { 3468 void resetPageSizeType() {
3464 SET_VAR(m_rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); 3469 SET_VAR(m_rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO);
3465 } 3470 }
3466 3471
3467 // Outline utility functions. 3472 // Outline utility functions.
3468 bool hasOutline() const { 3473 bool hasOutline() const {
3469 return outlineWidth() > 0 && outlineStyle() > BorderStyleHidden; 3474 return outlineWidth() > 0 && outlineStyle() > BorderStyleHidden;
3470 } 3475 }
3471 int outlineOutsetExtent() const; 3476 int outlineOutsetExtent() const;
3472 bool isOutlineEquivalent(const ComputedStyle* otherStyle) const {
3473 // No other style, so we don't have an outline then we consider them to be
3474 // the same.
3475 if (!otherStyle)
3476 return !hasOutline();
3477 return m_background->outline().visuallyEqual(
3478 otherStyle->m_background->outline());
3479 }
3480 void setOutlineFromStyle(const ComputedStyle& o) {
3481 DCHECK(!isOutlineEquivalent(&o));
3482 m_background.access()->m_outline = o.m_background->m_outline;
3483 }
3484 float getOutlineStrokeWidthForFocusRing() const; 3477 float getOutlineStrokeWidthForFocusRing() const;
3485 3478
3486 // Position utility functions. 3479 // Position utility functions.
3487 bool hasOutOfFlowPosition() const { 3480 bool hasOutOfFlowPosition() const {
3488 return position() == AbsolutePosition || position() == FixedPosition; 3481 return position() == AbsolutePosition || position() == FixedPosition;
3489 } 3482 }
3490 bool hasInFlowPosition() const { 3483 bool hasInFlowPosition() const {
3491 return position() == RelativePosition || position() == StickyPosition; 3484 return position() == RelativePosition || position() == StickyPosition;
3492 } 3485 }
3493 bool hasViewportConstrainedPosition() const { 3486 bool hasViewportConstrainedPosition() const {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
3946 } 3939 }
3947 StyleColor borderTopColor() const { return m_surround->border.top().color(); } 3940 StyleColor borderTopColor() const { return m_surround->border.top().color(); }
3948 StyleColor borderBottomColor() const { 3941 StyleColor borderBottomColor() const {
3949 return m_surround->border.bottom().color(); 3942 return m_surround->border.bottom().color();
3950 } 3943 }
3951 StyleColor backgroundColor() const { return m_background->color(); } 3944 StyleColor backgroundColor() const { return m_background->color(); }
3952 Color color() const; 3945 Color color() const;
3953 StyleColor columnRuleColor() const { 3946 StyleColor columnRuleColor() const {
3954 return m_rareNonInheritedData->m_multiCol->m_rule.color(); 3947 return m_rareNonInheritedData->m_multiCol->m_rule.color();
3955 } 3948 }
3956 StyleColor outlineColor() const { return m_background->outline().color(); } 3949 StyleColor outlineColor() const {
3950 return m_rareNonInheritedData->m_outline.color();
3951 }
3957 StyleColor textEmphasisColor() const { 3952 StyleColor textEmphasisColor() const {
3958 return m_rareInheritedData->textEmphasisColor(); 3953 return m_rareInheritedData->textEmphasisColor();
3959 } 3954 }
3960 StyleColor textFillColor() const { 3955 StyleColor textFillColor() const {
3961 return m_rareInheritedData->textFillColor(); 3956 return m_rareInheritedData->textFillColor();
3962 } 3957 }
3963 StyleColor textStrokeColor() const { 3958 StyleColor textStrokeColor() const {
3964 return m_rareInheritedData->textStrokeColor(); 3959 return m_rareInheritedData->textStrokeColor();
3965 } 3960 }
3966 Color visitedLinkColor() const; 3961 Color visitedLinkColor() const;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 4114 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
4120 } 4115 }
4121 4116
4122 inline bool ComputedStyle::hasPseudoElementStyle() const { 4117 inline bool ComputedStyle::hasPseudoElementStyle() const {
4123 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 4118 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
4124 } 4119 }
4125 4120
4126 } // namespace blink 4121 } // namespace blink
4127 4122
4128 #endif // ComputedStyle_h 4123 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698