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

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

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove platform differences from inline-text-textarea output Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 17 matching lines...) Expand all
28 #include "core/dom/RenderedDocumentMarker.h" 28 #include "core/dom/RenderedDocumentMarker.h"
29 #include "core/dom/Text.h" 29 #include "core/dom/Text.h"
30 #include "core/editing/Editor.h" 30 #include "core/editing/Editor.h"
31 #include "core/editing/InputMethodController.h" 31 #include "core/editing/InputMethodController.h"
32 #include "core/page/Frame.h" 32 #include "core/page/Frame.h"
33 #include "core/page/Page.h" 33 #include "core/page/Page.h"
34 #include "core/page/Settings.h" 34 #include "core/page/Settings.h"
35 #include "core/platform/graphics/DrawLooper.h" 35 #include "core/platform/graphics/DrawLooper.h"
36 #include "core/platform/graphics/FontCache.h" 36 #include "core/platform/graphics/FontCache.h"
37 #include "core/platform/graphics/GraphicsContextStateSaver.h" 37 #include "core/platform/graphics/GraphicsContextStateSaver.h"
38 #include "core/platform/graphics/WidthIterator.h"
38 #include "core/rendering/EllipsisBox.h" 39 #include "core/rendering/EllipsisBox.h"
39 #include "core/rendering/HitTestResult.h" 40 #include "core/rendering/HitTestResult.h"
40 #include "core/rendering/PaintInfo.h" 41 #include "core/rendering/PaintInfo.h"
41 #include "core/rendering/RenderBR.h" 42 #include "core/rendering/RenderBR.h"
42 #include "core/rendering/RenderBlock.h" 43 #include "core/rendering/RenderBlock.h"
43 #include "core/rendering/RenderCombineText.h" 44 #include "core/rendering/RenderCombineText.h"
44 #include "core/rendering/RenderRubyRun.h" 45 #include "core/rendering/RenderRubyRun.h"
45 #include "core/rendering/RenderRubyText.h" 46 #include "core/rendering/RenderRubyText.h"
46 #include "core/rendering/RenderTheme.h" 47 #include "core/rendering/RenderTheme.h"
47 #include "core/rendering/style/ShadowData.h" 48 #include "core/rendering/style/ShadowData.h"
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 return false; 1481 return false;
1481 1482
1482 // Offsets at the end are "out" for line breaks (they are on the next line). 1483 // Offsets at the end are "out" for line breaks (they are on the next line).
1483 if (isLineBreak()) 1484 if (isLineBreak())
1484 return false; 1485 return false;
1485 1486
1486 // Offsets at the end are "in" for normal boxes (but the caller has to check affinity). 1487 // Offsets at the end are "in" for normal boxes (but the caller has to check affinity).
1487 return true; 1488 return true;
1488 } 1489 }
1489 1490
1491 void InlineTextBox::characterWidths(float widths[]) const
1492 {
1493 FontCachePurgePreventer fontCachePurgePreventer;
1494
1495 RenderText* textObj = textRenderer();
1496 RenderStyle* styleToUse = textObj->style(isFirstLineStyle());
1497 const Font& font = styleToUse->font();
1498
1499 StringBuilder charactersWithHyphen;
1500 TextRun textRun = constructTextRun(styleToUse, font, hasHyphen() ? &characte rsWithHyphen : 0);
1501
1502 GlyphBuffer glyphBuffer;
1503 WidthIterator it(&font, textRun);
1504 float lastWidth = 0;
1505 for (unsigned i = 0; i < m_len; i++) {
1506 it.advance(i + 1, &glyphBuffer);
1507 widths[i] = it.m_runWidthSoFar - lastWidth;
1508 if (textRun.rtl())
1509 widths[i] = -widths[i];
1510 lastWidth = it.m_runWidthSoFar;
1511 }
1512 }
1513
1490 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, St ringBuilder* charactersWithHyphen) const 1514 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, St ringBuilder* charactersWithHyphen) const
1491 { 1515 {
1492 ASSERT(style); 1516 ASSERT(style);
1493 1517
1494 RenderText* textRenderer = this->textRenderer(); 1518 RenderText* textRenderer = this->textRenderer();
1495 ASSERT(textRenderer); 1519 ASSERT(textRenderer);
1496 ASSERT(textRenderer->text()); 1520 ASSERT(textRenderer->text());
1497 1521
1498 StringView string = textRenderer->text().createView(); 1522 StringView string = textRenderer->text().createView();
1499 unsigned startPos = start(); 1523 unsigned startPos = start();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); 1583 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj);
1560 const int rendererCharacterOffset = 24; 1584 const int rendererCharacterOffset = 24;
1561 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) 1585 for (; printedCharacters < rendererCharacterOffset; printedCharacters++)
1562 fputc(' ', stderr); 1586 fputc(' ', stderr);
1563 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 1587 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
1564 } 1588 }
1565 1589
1566 #endif 1590 #endif
1567 1591
1568 } // namespace WebCore 1592 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698