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

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

Issue 2884833003: Remove references to visual_data_ in ComputedStyle. (Closed)
Patch Set: Created 3 years, 7 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 * 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 // box-shadow (aka -webkit-box-shadow) 593 // box-shadow (aka -webkit-box-shadow)
594 static ShadowList* InitialBoxShadow() { return 0; } 594 static ShadowList* InitialBoxShadow() { return 0; }
595 ShadowList* BoxShadow() const { 595 ShadowList* BoxShadow() const {
596 return rare_non_inherited_data_->box_shadow_.Get(); 596 return rare_non_inherited_data_->box_shadow_.Get();
597 } 597 }
598 void SetBoxShadow(PassRefPtr<ShadowList>); 598 void SetBoxShadow(PassRefPtr<ShadowList>);
599 599
600 // clip 600 // clip
601 static LengthBox InitialClip() { return LengthBox(); } 601 static LengthBox InitialClip() { return LengthBox(); }
602 const LengthBox& Clip() const { return visual_data_->clip_; } 602 const LengthBox& Clip() const { return ClipInternal(); }
603 void SetClip(const LengthBox& box) { 603 void SetClip(const LengthBox& box) {
604 SET_VAR(visual_data_, has_auto_clip_, false); 604 SetHasAutoClipInternal(false);
605 SET_VAR(visual_data_, clip_, box); 605 SetClipInternal(box);
606 } 606 }
607 bool HasAutoClip() const { return visual_data_->has_auto_clip_; } 607 bool HasAutoClip() const { return HasAutoClipInternal(); }
608 void SetHasAutoClip() { 608 void SetHasAutoClip() {
609 SET_VAR(visual_data_, has_auto_clip_, true); 609 SetHasAutoClipInternal(true);
610 SET_VAR(visual_data_, clip_, ComputedStyle::InitialClip()); 610 SetClipInternal(ComputedStyle::InitialClip());
611 } 611 }
612 612
613 // Column properties. 613 // Column properties.
614 // column-count (aka -webkit-column-count) 614 // column-count (aka -webkit-column-count)
615 static unsigned short InitialColumnCount() { return 1; } 615 static unsigned short InitialColumnCount() { return 1; }
616 unsigned short ColumnCount() const { 616 unsigned short ColumnCount() const {
617 return rare_non_inherited_data_->multi_col_->count_; 617 return rare_non_inherited_data_->multi_col_->count_;
618 } 618 }
619 void SetColumnCount(unsigned short c) { 619 void SetColumnCount(unsigned short c) {
620 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, auto_count_, false); 620 SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, auto_count_, false);
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 void SetSubtreeIsSticky(bool b) { 1437 void SetSubtreeIsSticky(bool b) {
1438 SET_VAR(rare_inherited_data_, subtree_is_sticky_, b); 1438 SET_VAR(rare_inherited_data_, subtree_is_sticky_, b);
1439 } 1439 }
1440 1440
1441 // Text decoration properties. 1441 // Text decoration properties.
1442 // text-decoration-line 1442 // text-decoration-line
1443 static TextDecoration InitialTextDecoration() { 1443 static TextDecoration InitialTextDecoration() {
1444 return TextDecoration::kNone; 1444 return TextDecoration::kNone;
1445 } 1445 }
1446 TextDecoration GetTextDecoration() const { 1446 TextDecoration GetTextDecoration() const {
1447 return static_cast<TextDecoration>(visual_data_->text_decoration_); 1447 return static_cast<TextDecoration>(GetTextDecorationInternal());
1448 } 1448 }
1449 void SetTextDecoration(TextDecoration v) { 1449 void SetTextDecoration(TextDecoration v) { SetTextDecorationInternal(v); }
1450 SET_VAR(visual_data_, text_decoration_, static_cast<unsigned>(v));
1451 }
1452 1450
1453 // text-decoration-color 1451 // text-decoration-color
1454 void SetTextDecorationColor(const StyleColor& c) { 1452 void SetTextDecorationColor(const StyleColor& c) {
1455 SET_VAR(rare_non_inherited_data_, text_decoration_color_, c); 1453 SET_VAR(rare_non_inherited_data_, text_decoration_color_, c);
1456 } 1454 }
1457 1455
1458 // text-decoration-style 1456 // text-decoration-style
1459 static TextDecorationStyle InitialTextDecorationStyle() { 1457 static TextDecorationStyle InitialTextDecorationStyle() {
1460 return kTextDecorationStyleSolid; 1458 return kTextDecorationStyleSolid;
1461 } 1459 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 SetHasAutoZIndexInternal(false); 1557 SetHasAutoZIndexInternal(false);
1560 SetZIndexInternal(v); 1558 SetZIndexInternal(v);
1561 } 1559 }
1562 void SetHasAutoZIndex() { 1560 void SetHasAutoZIndex() {
1563 SetHasAutoZIndexInternal(true); 1561 SetHasAutoZIndexInternal(true);
1564 SetZIndexInternal(0); 1562 SetZIndexInternal(0);
1565 } 1563 }
1566 1564
1567 // zoom 1565 // zoom
1568 static float InitialZoom() { return 1.0f; } 1566 static float InitialZoom() { return 1.0f; }
1569 float Zoom() const { return visual_data_->zoom_; } 1567 float Zoom() const { return ZoomInternal(); }
1570 float EffectiveZoom() const { return rare_inherited_data_->effective_zoom_; } 1568 float EffectiveZoom() const { return rare_inherited_data_->effective_zoom_; }
1571 bool SetZoom(float); 1569 bool SetZoom(float);
1572 bool SetEffectiveZoom(float); 1570 bool SetEffectiveZoom(float);
1573 1571
1574 // -webkit-app-region 1572 // -webkit-app-region
1575 DraggableRegionMode GetDraggableRegionMode() const { 1573 DraggableRegionMode GetDraggableRegionMode() const {
1576 return rare_non_inherited_data_->draggable_region_mode_; 1574 return rare_non_inherited_data_->draggable_region_mode_;
1577 } 1575 }
1578 void SetDraggableRegionMode(DraggableRegionMode v) { 1576 void SetDraggableRegionMode(DraggableRegionMode v) {
1579 SET_VAR(rare_non_inherited_data_, draggable_region_mode_, v); 1577 SET_VAR(rare_non_inherited_data_, draggable_region_mode_, v);
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 bool HasInFlowPosition() const { 3032 bool HasInFlowPosition() const {
3035 return GetPosition() == EPosition::kRelative || 3033 return GetPosition() == EPosition::kRelative ||
3036 GetPosition() == EPosition::kSticky; 3034 GetPosition() == EPosition::kSticky;
3037 } 3035 }
3038 bool HasViewportConstrainedPosition() const { 3036 bool HasViewportConstrainedPosition() const {
3039 return GetPosition() == EPosition::kFixed || 3037 return GetPosition() == EPosition::kFixed ||
3040 GetPosition() == EPosition::kSticky; 3038 GetPosition() == EPosition::kSticky;
3041 } 3039 }
3042 3040
3043 // Clip utility functions. 3041 // Clip utility functions.
3044 const Length& ClipLeft() const { return visual_data_->clip_.Left(); } 3042 const Length& ClipLeft() const { return ClipInternal().Left(); }
3045 const Length& ClipRight() const { return visual_data_->clip_.Right(); } 3043 const Length& ClipRight() const { return ClipInternal().Right(); }
3046 const Length& ClipTop() const { return visual_data_->clip_.Top(); } 3044 const Length& ClipTop() const { return ClipInternal().Top(); }
3047 const Length& ClipBottom() const { return visual_data_->clip_.Bottom(); } 3045 const Length& ClipBottom() const { return ClipInternal().Bottom(); }
3048 3046
3049 // Offset utility functions. 3047 // Offset utility functions.
3050 // Accessors for positioned object edges that take into account writing mode. 3048 // Accessors for positioned object edges that take into account writing mode.
3051 const Length& LogicalLeft() const { 3049 const Length& LogicalLeft() const {
3052 return LengthBox::LogicalLeft(GetWritingMode(), Left(), Top()); 3050 return LengthBox::LogicalLeft(GetWritingMode(), Left(), Top());
3053 } 3051 }
3054 const Length& LogicalRight() const { 3052 const Length& LogicalRight() const {
3055 return LengthBox::LogicalRight(GetWritingMode(), Right(), Bottom()); 3053 return LengthBox::LogicalRight(GetWritingMode(), Right(), Bottom());
3056 } 3054 }
3057 const Length& LogicalTop() const { 3055 const Length& LogicalTop() const {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3711 float zoom_factor) { 3709 float zoom_factor) {
3712 return scroll_offset / zoom_factor; 3710 return scroll_offset / zoom_factor;
3713 } 3711 }
3714 3712
3715 inline float AdjustScrollForAbsoluteZoom(float scroll_offset, 3713 inline float AdjustScrollForAbsoluteZoom(float scroll_offset,
3716 const ComputedStyle& style) { 3714 const ComputedStyle& style) {
3717 return AdjustScrollForAbsoluteZoom(scroll_offset, style.EffectiveZoom()); 3715 return AdjustScrollForAbsoluteZoom(scroll_offset, style.EffectiveZoom());
3718 } 3716 }
3719 3717
3720 inline bool ComputedStyle::SetZoom(float f) { 3718 inline bool ComputedStyle::SetZoom(float f) {
3721 if (compareEqual(visual_data_->zoom_, f)) 3719 if (compareEqual(ZoomInternal(), f))
3722 return false; 3720 return false;
3723 visual_data_.Access()->zoom_ = f; 3721 SetZoomInternal(f);
3724 SetEffectiveZoom(EffectiveZoom() * Zoom()); 3722 SetEffectiveZoom(EffectiveZoom() * Zoom());
3725 return true; 3723 return true;
3726 } 3724 }
3727 3725
3728 inline bool ComputedStyle::SetEffectiveZoom(float f) { 3726 inline bool ComputedStyle::SetEffectiveZoom(float f) {
3729 // Clamp the effective zoom value to a smaller (but hopeful still large 3727 // Clamp the effective zoom value to a smaller (but hopeful still large
3730 // enough) range, to avoid overflow in derived computations. 3728 // enough) range, to avoid overflow in derived computations.
3731 float clamped_effective_zoom = clampTo<float>(f, 1e-6, 1e6); 3729 float clamped_effective_zoom = clampTo<float>(f, 1e-6, 1e6);
3732 if (compareEqual(rare_inherited_data_->effective_zoom_, 3730 if (compareEqual(rare_inherited_data_->effective_zoom_,
3733 clamped_effective_zoom)) 3731 clamped_effective_zoom))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3771 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3769 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3772 } 3770 }
3773 3771
3774 inline bool ComputedStyle::HasPseudoElementStyle() const { 3772 inline bool ComputedStyle::HasPseudoElementStyle() const {
3775 return PseudoBitsInternal() & kElementPseudoIdMask; 3773 return PseudoBitsInternal() & kElementPseudoIdMask;
3776 } 3774 }
3777 3775
3778 } // namespace blink 3776 } // namespace blink
3779 3777
3780 #endif // ComputedStyle_h 3778 #endif // ComputedStyle_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