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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ImageQualityController::remove(this); 106 ImageQualityController::remove(this);
107 107
108 // A continuation of this RenderObject should be destroyed at subclasses. 108 // A continuation of this RenderObject should be destroyed at subclasses.
109 ASSERT(!continuation()); 109 ASSERT(!continuation());
110 110
111 RenderLayerModelObject::willBeDestroyed(); 111 RenderLayerModelObject::willBeDestroyed();
112 } 112 }
113 113
114 bool RenderBoxModelObject::calculateHasBoxDecorations() const 114 bool RenderBoxModelObject::calculateHasBoxDecorations() const
115 { 115 {
116 RenderStyle* styleToUse = style(); 116 const RenderStyle* styleToUse = style();
117 ASSERT(styleToUse); 117 ASSERT(styleToUse);
118 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan ce() || styleToUse->boxShadow(); 118 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan ce() || styleToUse->boxShadow();
119 } 119 }
120 120
121 void RenderBoxModelObject::updateFromStyle() 121 void RenderBoxModelObject::updateFromStyle()
122 { 122 {
123 RenderLayerModelObject::updateFromStyle(); 123 RenderLayerModelObject::updateFromStyle();
124 124
125 RenderStyle* styleToUse = style(); 125 const RenderStyle* styleToUse = style();
126 setHasBoxDecorationBackground(calculateHasBoxDecorations()); 126 setHasBoxDecorationBackground(calculateHasBoxDecorations());
127 setInline(styleToUse->isDisplayInlineType()); 127 setInline(styleToUse->isDisplayInlineType());
128 setPositionState(styleToUse->position()); 128 setPositionState(styleToUse->position());
129 setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); 129 setHorizontalWritingMode(styleToUse->isHorizontalWritingMode());
130 } 130 }
131 131
132 static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child) 132 static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child)
133 { 133 {
134 if (!child->isAnonymousBlock() || !child->isRelPositioned()) 134 if (!child->isAnonymousBlock() || !child->isRelPositioned())
135 return LayoutSize(); 135 return LayoutSize();
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 493 }
494 494
495 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset) 495 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset)
496 { 496 {
497 ASSERT(!slowFirstChild()); 497 ASSERT(!slowFirstChild());
498 498
499 // FIXME: This does not take into account either :first-line or :first-lette r 499 // FIXME: This does not take into account either :first-line or :first-lette r
500 // However, as soon as some content is entered, the line boxes will be 500 // However, as soon as some content is entered, the line boxes will be
501 // constructed and this kludge is not called any more. So only the caret siz e 501 // constructed and this kludge is not called any more. So only the caret siz e
502 // of an empty :first-line'd block is wrong. I think we can live with that. 502 // of an empty :first-line'd block is wrong. I think we can live with that.
503 RenderStyle* currentStyle = firstLineStyle(); 503 const RenderStyle* currentStyle = firstLineStyle();
504 504
505 enum CaretAlignment { alignLeft, alignRight, alignCenter }; 505 enum CaretAlignment { alignLeft, alignRight, alignCenter };
506 506
507 CaretAlignment alignment = alignLeft; 507 CaretAlignment alignment = alignLeft;
508 508
509 switch (currentStyle->textAlign()) { 509 switch (currentStyle->textAlign()) {
510 case LEFT: 510 case LEFT:
511 case WEBKIT_LEFT: 511 case WEBKIT_LEFT:
512 break; 512 break;
513 case CENTER: 513 case CENTER:
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 655 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
656 for (RenderObject* child = startChild; child && child != endChild; ) { 656 for (RenderObject* child = startChild; child && child != endChild; ) {
657 // Save our next sibling as moveChildTo will clear it. 657 // Save our next sibling as moveChildTo will clear it.
658 RenderObject* nextSibling = child->nextSibling(); 658 RenderObject* nextSibling = child->nextSibling();
659 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 659 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
660 child = nextSibling; 660 child = nextSibling;
661 } 661 }
662 } 662 }
663 663
664 } // namespace blink 664 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698