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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutRubyRun.cpp

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 LayoutRubyBase* rubyBase = this->rubyBase(); 272 LayoutRubyBase* rubyBase = this->rubyBase();
273 LayoutRubyText* rubyText = this->rubyText(); 273 LayoutRubyText* rubyText = this->rubyText();
274 274
275 if (!rubyBase || !rubyText) 275 if (!rubyBase || !rubyText)
276 return; 276 return;
277 277
278 if (!rubyBase->firstRootBox()) 278 if (!rubyBase->firstRootBox())
279 return; 279 return;
280 280
281 int logicalWidth = this->logicalWidth(); 281 int logicalWidth = this->logicalWidth().toInt();
282 int logicalLeftOverhang = std::numeric_limits<int>::max(); 282 int logicalLeftOverhang = std::numeric_limits<int>::max();
283 int logicalRightOverhang = std::numeric_limits<int>::max(); 283 int logicalRightOverhang = std::numeric_limits<int>::max();
284 for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) { 284 for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) {
285 logicalLeftOverhang = std::min<int>(logicalLeftOverhang, rootInlineBox-> logicalLeft()); 285 logicalLeftOverhang = std::min<int>(logicalLeftOverhang, rootInlineBox-> logicalLeft().toInt());
286 logicalRightOverhang = std::min<int>(logicalRightOverhang, logicalWidth - rootInlineBox->logicalRight()); 286 logicalRightOverhang = std::min<int>(logicalRightOverhang, (logicalWidth - rootInlineBox->logicalRight()).toInt());
287 } 287 }
288 288
289 startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : lo gicalRightOverhang; 289 startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : lo gicalRightOverhang;
290 endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : log icalLeftOverhang; 290 endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : log icalLeftOverhang;
291 291
292 if (!startLayoutObject || !startLayoutObject->isText() || startLayoutObject- >style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize()) 292 if (!startLayoutObject || !startLayoutObject->isText() || startLayoutObject- >style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
293 startOverhang = 0; 293 startOverhang = 0;
294 294
295 if (!endLayoutObject || !endLayoutObject->isText() || endLayoutObject->style (firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize()) 295 if (!endLayoutObject || !endLayoutObject->isText() || endLayoutObject->style (firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
296 endOverhang = 0; 296 endOverhang = 0;
(...skipping 27 matching lines...) Expand all
324 case U_LB_GLUE: 324 case U_LB_GLUE:
325 case U_LB_OPEN_PUNCTUATION: 325 case U_LB_OPEN_PUNCTUATION:
326 return false; 326 return false;
327 default: 327 default:
328 break; 328 break;
329 } 329 }
330 return true; 330 return true;
331 } 331 }
332 332
333 } // namespace blink 333 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutRubyBase.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutRubyText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698