| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 void GraphicsContext::setPaintingDisabled(bool f) | 373 void GraphicsContext::setPaintingDisabled(bool f) |
| 374 { | 374 { |
| 375 m_state.paintingDisabled = f; | 375 m_state.paintingDisabled = f; |
| 376 } | 376 } |
| 377 | 377 |
| 378 bool GraphicsContext::paintingDisabled() const | 378 bool GraphicsContext::paintingDisabled() const |
| 379 { | 379 { |
| 380 return m_state.paintingDisabled; | 380 return m_state.paintingDisabled; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void GraphicsContext::drawText(const Font& font, const TextRun& run, const Float
Point& point, int from, int to) | 383 void GraphicsContext::drawText(const Font& font, const TextRun& run, const Float
Point& point, const FloatRect& textRect, int from, int to) |
| 384 { | 384 { |
| 385 if (paintingDisabled()) | 385 if (paintingDisabled()) |
| 386 return; | 386 return; |
| 387 | 387 |
| 388 font.drawText(this, run, point, from, to); | 388 font.drawText(this, run, point, textRect, from, to); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRun& run, co
nst AtomicString& mark, const FloatPoint& point, int from, int to) | 391 void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRun& run, co
nst AtomicString& mark, const FloatPoint& point, const FloatRect& textRect, int
from, int to) |
| 392 { | 392 { |
| 393 if (paintingDisabled()) | 393 if (paintingDisabled()) |
| 394 return; | 394 return; |
| 395 | 395 |
| 396 font.drawEmphasisMarks(this, run, mark, point, from, to); | 396 font.drawEmphasisMarks(this, run, mark, point, textRect, from, to); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const F
loatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction) | 399 void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const F
loatPoint& point, const FloatRect& textRect, Font::CustomFontNotReadyAction cust
omFontNotReadyAction) |
| 400 { | 400 { |
| 401 if (paintingDisabled()) | 401 if (paintingDisabled()) |
| 402 return; | 402 return; |
| 403 | 403 |
| 404 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; | 404 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; |
| 405 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); | 405 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); |
| 406 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); | 406 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); |
| 407 | 407 |
| 408 // FIXME: This ownership should be reversed. We should pass BidiRunList | 408 // FIXME: This ownership should be reversed. We should pass BidiRunList |
| 409 // to BidiResolver in createBidiRunsForLine. | 409 // to BidiResolver in createBidiRunsForLine. |
| 410 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); | 410 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); |
| 411 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length())); | 411 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length())); |
| 412 if (!bidiRuns.runCount()) | 412 if (!bidiRuns.runCount()) |
| 413 return; | 413 return; |
| 414 | 414 |
| 415 FloatPoint currPoint = point; | 415 FloatPoint currPoint = point; |
| 416 BidiCharacterRun* bidiRun = bidiRuns.firstRun(); | 416 BidiCharacterRun* bidiRun = bidiRuns.firstRun(); |
| 417 while (bidiRun) { | 417 while (bidiRun) { |
| 418 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun-
>start()); | 418 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun-
>start()); |
| 419 bool isRTL = bidiRun->level() % 2; | 419 bool isRTL = bidiRun->level() % 2; |
| 420 subrun.setDirection(isRTL ? RTL : LTR); | 420 subrun.setDirection(isRTL ? RTL : LTR); |
| 421 subrun.setDirectionalOverride(bidiRun->dirOverride(false)); | 421 subrun.setDirectionalOverride(bidiRun->dirOverride(false)); |
| 422 | 422 |
| 423 font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction); | 423 font.drawText(this, subrun, currPoint, textRect, 0, -1, customFontNotRea
dyAction); |
| 424 | 424 |
| 425 bidiRun = bidiRun->next(); | 425 bidiRun = bidiRun->next(); |
| 426 // FIXME: Have Font::drawText return the width of what it drew so that w
e don't have to re-measure here. | 426 // FIXME: Have Font::drawText return the width of what it drew so that w
e don't have to re-measure here. |
| 427 if (bidiRun) | 427 if (bidiRun) |
| 428 currPoint.move(font.width(subrun), 0); | 428 currPoint.move(font.width(subrun), 0); |
| 429 } | 429 } |
| 430 | 430 |
| 431 bidiRuns.deleteRuns(); | 431 bidiRuns.deleteRuns(); |
| 432 } | 432 } |
| 433 | 433 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 774 } |
| 775 | 775 |
| 776 void GraphicsContext::strokeEllipseAsPath(const FloatRect& ellipse) | 776 void GraphicsContext::strokeEllipseAsPath(const FloatRect& ellipse) |
| 777 { | 777 { |
| 778 Path path; | 778 Path path; |
| 779 path.addEllipse(ellipse); | 779 path.addEllipse(ellipse); |
| 780 strokePath(path); | 780 strokePath(path); |
| 781 } | 781 } |
| 782 | 782 |
| 783 } | 783 } |
| OLD | NEW |