| OLD | NEW |
| 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-2009, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #ifndef LayoutText_h | 23 #ifndef LayoutText_h |
| 24 #define LayoutText_h | 24 #define LayoutText_h |
| 25 | 25 |
| 26 #include <iterator> |
| 26 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
| 27 #include "core/dom/Text.h" | 28 #include "core/dom/Text.h" |
| 28 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
| 29 #include "core/layout/TextRunConstructor.h" | 30 #include "core/layout/TextRunConstructor.h" |
| 30 #include "platform/LengthFunctions.h" | 31 #include "platform/LengthFunctions.h" |
| 31 #include "platform/wtf/Forward.h" | 32 #include "platform/wtf/Forward.h" |
| 32 #include "platform/wtf/PassRefPtr.h" | 33 #include "platform/wtf/PassRefPtr.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 return font.Width(ConstructTextRun(font, style.HyphenString().GetString(), | 346 return font.Width(ConstructTextRun(font, style.HyphenString().GetString(), |
| 346 style, direction)); | 347 style, direction)); |
| 347 } | 348 } |
| 348 | 349 |
| 349 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, IsText()); | 350 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, IsText()); |
| 350 | 351 |
| 351 inline LayoutText* Text::GetLayoutObject() const { | 352 inline LayoutText* Text::GetLayoutObject() const { |
| 352 return ToLayoutText(CharacterData::GetLayoutObject()); | 353 return ToLayoutText(CharacterData::GetLayoutObject()); |
| 353 } | 354 } |
| 354 | 355 |
| 356 // Represents list of |InlineTextBox| objects associated to |LayoutText| in |
| 357 // layout order. |
| 358 class InlineTextBoxRange { |
| 359 public: |
| 360 class Iterator |
| 361 : public std::iterator<std::input_iterator_tag, InlineTextBox*> { |
| 362 public: |
| 363 explicit Iterator(InlineTextBox*); |
| 364 Iterator(const Iterator&) = default; |
| 365 |
| 366 Iterator& operator++(); |
| 367 InlineTextBox* operator*() const; |
| 368 |
| 369 bool operator==(const Iterator& other) const { |
| 370 return current_ == other.current_; |
| 371 } |
| 372 bool operator!=(const Iterator& other) const { return !operator==(other); } |
| 373 |
| 374 private: |
| 375 InlineTextBox* current_; |
| 376 }; |
| 377 |
| 378 explicit InlineTextBoxRange(const LayoutText&); |
| 379 |
| 380 Iterator begin() const { return Iterator(layout_text_->FirstTextBox()); } |
| 381 Iterator end() const { return Iterator(nullptr); } |
| 382 |
| 383 private: |
| 384 const LayoutText* layout_text_; |
| 385 }; |
| 386 |
| 387 InlineTextBoxRange InlineTextBoxesOf(const LayoutText&); |
| 388 |
| 355 void ApplyTextTransform(const ComputedStyle*, String&, UChar); | 389 void ApplyTextTransform(const ComputedStyle*, String&, UChar); |
| 356 | 390 |
| 357 } // namespace blink | 391 } // namespace blink |
| 358 | 392 |
| 359 #endif // LayoutText_h | 393 #endif // LayoutText_h |
| OLD | NEW |