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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderMarquee.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return result; 98 return result;
99 } 99 }
100 100
101 bool RenderMarquee::isHorizontal() const 101 bool RenderMarquee::isHorizontal() const
102 { 102 {
103 return direction() == MLEFT || direction() == MRIGHT; 103 return direction() == MLEFT || direction() == MRIGHT;
104 } 104 }
105 105
106 int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge ) 106 int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge )
107 { 107 {
108 RenderBox* box = m_layer->renderBox(); 108 RenderBox* o = m_layer->renderer();
109 ASSERT(box); 109 RenderStyle* s = o->style();
110 RenderStyle* s = box->style();
111 if (isHorizontal()) { 110 if (isHorizontal()) {
112 bool ltr = s->direction() == LTR; 111 bool ltr = s->direction() == LTR;
113 int clientWidth = box->clientWidth(); 112 int clientWidth = o->clientWidth();
114 int contentWidth = ltr ? box->rightmostPosition(true, false) : box->left mostPosition(true, false); 113 int contentWidth = ltr ? o->rightmostPosition(true, false) : o->leftmost Position(true, false);
115 if (ltr) 114 if (ltr)
116 contentWidth += (box->paddingRight() - box->borderLeft()); 115 contentWidth += (o->paddingRight() - o->borderLeft());
117 else { 116 else {
118 contentWidth = box->width() - contentWidth; 117 contentWidth = o->width() - contentWidth;
119 contentWidth += (box->paddingLeft() - box->borderRight()); 118 contentWidth += (o->paddingLeft() - o->borderRight());
120 } 119 }
121 if (dir == MRIGHT) { 120 if (dir == MRIGHT) {
122 if (stopAtContentEdge) 121 if (stopAtContentEdge)
123 return max(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth)); 122 return max(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
124 else 123 else
125 return ltr ? contentWidth : clientWidth; 124 return ltr ? contentWidth : clientWidth;
126 } 125 }
127 else { 126 else {
128 if (stopAtContentEdge) 127 if (stopAtContentEdge)
129 return min(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth)); 128 return min(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
130 else 129 else
131 return ltr ? -clientWidth : -contentWidth; 130 return ltr ? -clientWidth : -contentWidth;
132 } 131 }
133 } 132 }
134 else { 133 else {
135 int contentHeight = box->lowestPosition(true, false) - 134 int contentHeight = m_layer->renderer()->lowestPosition(true, false) -
136 box->borderTop() + box->paddingBottom(); 135 m_layer->renderer()->borderTop() + m_layer->renderer ()->paddingBottom();
137 int clientHeight = box->clientHeight(); 136 int clientHeight = m_layer->renderer()->clientHeight();
138 if (dir == MUP) { 137 if (dir == MUP) {
139 if (stopAtContentEdge) 138 if (stopAtContentEdge)
140 return min(contentHeight - clientHeight, 0); 139 return min(contentHeight - clientHeight, 0);
141 else 140 else
142 return -clientHeight; 141 return -clientHeight;
143 } 142 }
144 else { 143 else {
145 if (stopAtContentEdge) 144 if (stopAtContentEdge)
146 return max(contentHeight - clientHeight, 0); 145 return max(contentHeight - clientHeight, 0);
147 else 146 else
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 else { 276 else {
278 bool addIncrement = direction() == MUP || direction() == MLEFT; 277 bool addIncrement = direction() == MUP || direction() == MLEFT;
279 bool isReversed = s->marqueeBehavior() == MALTERNATE && m_currentLoop % 2; 278 bool isReversed = s->marqueeBehavior() == MALTERNATE && m_currentLoop % 2;
280 if (isReversed) { 279 if (isReversed) {
281 // We're going in the reverse direction. 280 // We're going in the reverse direction.
282 endPoint = m_start; 281 endPoint = m_start;
283 range = -range; 282 range = -range;
284 addIncrement = !addIncrement; 283 addIncrement = !addIncrement;
285 } 284 }
286 bool positive = range > 0; 285 bool positive = range > 0;
287 int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight()); 286 int clientSize = (isHorizontal() ? m_layer->renderer()->clientWidth() : m_layer->renderer()->clientHeight());
288 int increment = max(1, abs(m_layer->renderer()->style()->marqueeIncremen t().calcValue(clientSize))); 287 int increment = max(1, abs(m_layer->renderer()->style()->marqueeIncremen t().calcValue(clientSize)));
289 int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->s crollYOffset()); 288 int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->s crollYOffset());
290 newPos = currentPos + (addIncrement ? increment : -increment); 289 newPos = currentPos + (addIncrement ? increment : -increment);
291 if (positive) 290 if (positive)
292 newPos = min(newPos, endPoint); 291 newPos = min(newPos, endPoint);
293 else 292 else
294 newPos = max(newPos, endPoint); 293 newPos = max(newPos, endPoint);
295 } 294 }
296 295
297 if (newPos == endPoint) { 296 if (newPos == endPoint) {
298 m_currentLoop++; 297 m_currentLoop++;
299 if (m_totalLoops > 0 && m_currentLoop >= m_totalLoops) 298 if (m_totalLoops > 0 && m_currentLoop >= m_totalLoops)
300 m_timer.stop(); 299 m_timer.stop();
301 else if (s->marqueeBehavior() != MALTERNATE) 300 else if (s->marqueeBehavior() != MALTERNATE)
302 m_reset = true; 301 m_reset = true;
303 } 302 }
304 303
305 if (isHorizontal()) 304 if (isHorizontal())
306 m_layer->scrollToXOffset(newPos); 305 m_layer->scrollToXOffset(newPos);
307 else 306 else
308 m_layer->scrollToYOffset(newPos); 307 m_layer->scrollToYOffset(newPos);
309 } 308 }
310 309
311 } // namespace WebCore 310 } // namespace WebCore
312 311
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderListMarker.cpp ('k') | third_party/WebKit/WebCore/rendering/RenderMedia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698