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

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

Issue 2508743002: Changed EWhiteSpace to an enum class and renamed its members to keywords (Closed)
Patch Set: Small mac fix Created 4 years 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 m_inheritedData.m_captionSide = static_cast<unsigned>(initialCaptionSide()); 366 m_inheritedData.m_captionSide = static_cast<unsigned>(initialCaptionSide());
367 m_inheritedData.m_listStyleType = 367 m_inheritedData.m_listStyleType =
368 static_cast<unsigned>(initialListStyleType()); 368 static_cast<unsigned>(initialListStyleType());
369 m_inheritedData.m_listStylePosition = 369 m_inheritedData.m_listStylePosition =
370 static_cast<unsigned>(initialListStylePosition()); 370 static_cast<unsigned>(initialListStylePosition());
371 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign()); 371 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign());
372 m_inheritedData.m_textTransform = initialTextTransform(); 372 m_inheritedData.m_textTransform = initialTextTransform();
373 m_inheritedData.m_hasSimpleUnderline = false; 373 m_inheritedData.m_hasSimpleUnderline = false;
374 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); 374 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor());
375 m_inheritedData.m_direction = initialDirection(); 375 m_inheritedData.m_direction = initialDirection();
376 m_inheritedData.m_whiteSpace = initialWhiteSpace(); 376 m_inheritedData.m_whiteSpace = static_cast<unsigned>(initialWhiteSpace());
377 m_inheritedData.m_borderCollapse = initialBorderCollapse(); 377 m_inheritedData.m_borderCollapse = initialBorderCollapse();
378 m_inheritedData.m_rtlOrdering = initialRTLOrdering(); 378 m_inheritedData.m_rtlOrdering = initialRTLOrdering();
379 m_inheritedData.m_boxDirection = initialBoxDirection(); 379 m_inheritedData.m_boxDirection = initialBoxDirection();
380 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust(); 380 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust();
381 m_inheritedData.m_pointerEvents = initialPointerEvents(); 381 m_inheritedData.m_pointerEvents = initialPointerEvents();
382 m_inheritedData.m_insideLink = NotInsideLink; 382 m_inheritedData.m_insideLink = NotInsideLink;
383 m_inheritedData.m_writingMode = initialWritingMode(); 383 m_inheritedData.m_writingMode = initialWritingMode();
384 384
385 m_nonInheritedData.m_effectiveDisplay = 385 m_nonInheritedData.m_effectiveDisplay =
386 m_nonInheritedData.m_originalDisplay = 386 m_nonInheritedData.m_originalDisplay =
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 // text-transform (aka -epub-text-transform) 2305 // text-transform (aka -epub-text-transform)
2306 static ETextTransform initialTextTransform() { return TTNONE; } 2306 static ETextTransform initialTextTransform() { return TTNONE; }
2307 ETextTransform textTransform() const { 2307 ETextTransform textTransform() const {
2308 return static_cast<ETextTransform>(m_inheritedData.m_textTransform); 2308 return static_cast<ETextTransform>(m_inheritedData.m_textTransform);
2309 } 2309 }
2310 void setTextTransform(ETextTransform v) { 2310 void setTextTransform(ETextTransform v) {
2311 m_inheritedData.m_textTransform = v; 2311 m_inheritedData.m_textTransform = v;
2312 } 2312 }
2313 2313
2314 // white-space inherited 2314 // white-space inherited
2315 static EWhiteSpace initialWhiteSpace() { return NORMAL; } 2315 static EWhiteSpace initialWhiteSpace() { return EWhiteSpace::Normal; }
2316 EWhiteSpace whiteSpace() const { 2316 EWhiteSpace whiteSpace() const {
2317 return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace); 2317 return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace);
2318 } 2318 }
2319 void setWhiteSpace(EWhiteSpace v) { m_inheritedData.m_whiteSpace = v; } 2319 void setWhiteSpace(EWhiteSpace v) {
2320 m_inheritedData.m_whiteSpace = static_cast<unsigned>(v);
2321 }
2320 2322
2321 // word-break inherited (aka -epub-word-break) 2323 // word-break inherited (aka -epub-word-break)
2322 static EWordBreak initialWordBreak() { return NormalWordBreak; } 2324 static EWordBreak initialWordBreak() { return NormalWordBreak; }
2323 EWordBreak wordBreak() const { 2325 EWordBreak wordBreak() const {
2324 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak); 2326 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak);
2325 } 2327 }
2326 void setWordBreak(EWordBreak b) { 2328 void setWordBreak(EWordBreak b) {
2327 SET_VAR(m_rareInheritedData, wordBreak, b); 2329 SET_VAR(m_rareInheritedData, wordBreak, b);
2328 } 2330 }
2329 2331
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 bool canContainAbsolutePositionObjects() const { 3733 bool canContainAbsolutePositionObjects() const {
3732 return position() != StaticPosition; 3734 return position() != StaticPosition;
3733 } 3735 }
3734 bool canContainFixedPositionObjects() const { 3736 bool canContainFixedPositionObjects() const {
3735 return hasTransformRelatedProperty() || containsPaint(); 3737 return hasTransformRelatedProperty() || containsPaint();
3736 } 3738 }
3737 3739
3738 // Whitespace utility functions. 3740 // Whitespace utility functions.
3739 static bool autoWrap(EWhiteSpace ws) { 3741 static bool autoWrap(EWhiteSpace ws) {
3740 // Nowrap and pre don't automatically wrap. 3742 // Nowrap and pre don't automatically wrap.
3741 return ws != NOWRAP && ws != PRE; 3743 return ws != EWhiteSpace::Nowrap && ws != EWhiteSpace::Pre;
3742 } 3744 }
3743 3745
3744 bool autoWrap() const { return autoWrap(whiteSpace()); } 3746 bool autoWrap() const { return autoWrap(whiteSpace()); }
3745 3747
3746 static bool preserveNewline(EWhiteSpace ws) { 3748 static bool preserveNewline(EWhiteSpace ws) {
3747 // Normal and nowrap do not preserve newlines. 3749 // Normal and nowrap do not preserve newlines.
3748 return ws != NORMAL && ws != NOWRAP; 3750 return ws != EWhiteSpace::Normal && ws != EWhiteSpace::Nowrap;
3749 } 3751 }
3750 3752
3751 bool preserveNewline() const { return preserveNewline(whiteSpace()); } 3753 bool preserveNewline() const { return preserveNewline(whiteSpace()); }
3752 3754
3753 static bool collapseWhiteSpace(EWhiteSpace ws) { 3755 static bool collapseWhiteSpace(EWhiteSpace ws) {
3754 // Pre and prewrap do not collapse whitespace. 3756 // Pre and prewrap do not collapse whitespace.
3755 return ws != PRE && ws != PRE_WRAP; 3757 return ws != EWhiteSpace::Pre && ws != EWhiteSpace::PreWrap;
3756 } 3758 }
3757 3759
3758 bool collapseWhiteSpace() const { return collapseWhiteSpace(whiteSpace()); } 3760 bool collapseWhiteSpace() const { return collapseWhiteSpace(whiteSpace()); }
3759 3761
3760 bool isCollapsibleWhiteSpace(UChar c) const { 3762 bool isCollapsibleWhiteSpace(UChar c) const {
3761 switch (c) { 3763 switch (c) {
3762 case ' ': 3764 case ' ':
3763 case '\t': 3765 case '\t':
3764 return collapseWhiteSpace(); 3766 return collapseWhiteSpace();
3765 case '\n': 3767 case '\n':
3766 return !preserveNewline(); 3768 return !preserveNewline();
3767 } 3769 }
3768 return false; 3770 return false;
3769 } 3771 }
3770 bool breakOnlyAfterWhiteSpace() const { 3772 bool breakOnlyAfterWhiteSpace() const {
3771 return whiteSpace() == PRE_WRAP || 3773 return whiteSpace() == EWhiteSpace::PreWrap ||
3772 getLineBreak() == LineBreakAfterWhiteSpace; 3774 getLineBreak() == LineBreakAfterWhiteSpace;
3773 } 3775 }
3774 3776
3775 bool breakWords() const { 3777 bool breakWords() const {
3776 return (wordBreak() == BreakWordBreak || 3778 return (wordBreak() == BreakWordBreak ||
3777 overflowWrap() == BreakOverflowWrap) && 3779 overflowWrap() == BreakOverflowWrap) &&
3778 whiteSpace() != PRE && whiteSpace() != NOWRAP; 3780 whiteSpace() != EWhiteSpace::Pre &&
3781 whiteSpace() != EWhiteSpace::Nowrap;
3779 } 3782 }
3780 3783
3781 // Text direction utility functions. 3784 // Text direction utility functions.
3782 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { 3785 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const {
3783 return !isLeftToRightDirection() && isHorizontalWritingMode(); 3786 return !isLeftToRightDirection() && isHorizontalWritingMode();
3784 } 3787 }
3785 bool hasInlinePaginationAxis() const { 3788 bool hasInlinePaginationAxis() const {
3786 // If the pagination axis is parallel with the writing mode inline axis, 3789 // If the pagination axis is parallel with the writing mode inline axis,
3787 // columns may be laid out along the inline axis, just like for regular 3790 // columns may be laid out along the inline axis, just like for regular
3788 // multicol. Otherwise, we need to lay out along the block axis. 3791 // multicol. Otherwise, we need to lay out along the block axis.
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 4114 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
4112 } 4115 }
4113 4116
4114 inline bool ComputedStyle::hasPseudoElementStyle() const { 4117 inline bool ComputedStyle::hasPseudoElementStyle() const {
4115 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 4118 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
4116 } 4119 }
4117 4120
4118 } // namespace blink 4121 } // namespace blink
4119 4122
4120 #endif // ComputedStyle_h 4123 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698