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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.h

Issue 2664713002: Use switch statement instead of bit masking for EPosition. (Closed)
Patch Set: Merge switch cases Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | 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) 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 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 } 2423 }
2424 bool isInFlowPositioned() const { 2424 bool isInFlowPositioned() const {
2425 return m_positionedState == IsRelativelyPositioned || 2425 return m_positionedState == IsRelativelyPositioned ||
2426 m_positionedState == IsStickyPositioned; 2426 m_positionedState == IsStickyPositioned;
2427 } 2427 }
2428 bool isPositioned() const { 2428 bool isPositioned() const {
2429 return m_positionedState != IsStaticallyPositioned; 2429 return m_positionedState != IsStaticallyPositioned;
2430 } 2430 }
2431 2431
2432 void setPositionedState(int positionState) { 2432 void setPositionedState(int positionState) {
2433 // This mask maps FixedPosition and AbsolutePosition to 2433 // This maps FixedPosition and AbsolutePosition to
2434 // IsOutOfFlowPositioned, saving one bit. 2434 // IsOutOfFlowPositioned, saving one bit.
2435 m_positionedState = static_cast<PositionedState>(positionState & 0x3); 2435 switch (positionState) {
2436 case StaticPosition:
2437 m_positionedState = IsStaticallyPositioned;
2438 break;
2439 case RelativePosition:
2440 m_positionedState = IsRelativelyPositioned;
2441 break;
2442 case AbsolutePosition:
2443 case FixedPosition:
2444 m_positionedState = IsOutOfFlowPositioned;
2445 break;
2446 case StickyPosition:
2447 m_positionedState = IsStickyPositioned;
2448 break;
2449 default:
2450 NOTREACHED();
2451 break;
2452 }
2436 } 2453 }
2437 void clearPositionedState() { m_positionedState = StaticPosition; } 2454 void clearPositionedState() { m_positionedState = StaticPosition; }
2438 2455
2439 ALWAYS_INLINE SelectionState getSelectionState() const { 2456 ALWAYS_INLINE SelectionState getSelectionState() const {
2440 return static_cast<SelectionState>(m_selectionState); 2457 return static_cast<SelectionState>(m_selectionState);
2441 } 2458 }
2442 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { 2459 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) {
2443 m_selectionState = selectionState; 2460 m_selectionState = selectionState;
2444 } 2461 }
2445 2462
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2740 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2724 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2741 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2725 // We don't make object2 an optional parameter so that showLayoutTree 2742 // We don't make object2 an optional parameter so that showLayoutTree
2726 // can be called from gdb easily. 2743 // can be called from gdb easily.
2727 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2744 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2728 const blink::LayoutObject* object2); 2745 const blink::LayoutObject* object2);
2729 2746
2730 #endif 2747 #endif
2731 2748
2732 #endif // LayoutObject_h 2749 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698