Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 | 228 |
| 229 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const | 229 IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const |
| 230 { | 230 { |
| 231 if (isNull()) | 231 if (isNull()) |
| 232 return IntRect(); | 232 return IntRect(); |
| 233 | 233 |
| 234 IntRect localRect = pixelSnappedIntRect(m_layoutObject->localCaretRect(m_inl ineBox, m_offset, extraWidthToEndOfLine)); | 234 IntRect localRect = pixelSnappedIntRect(m_layoutObject->localCaretRect(m_inl ineBox, m_offset, extraWidthToEndOfLine)); |
| 235 return localRect == IntRect() ? IntRect() : m_layoutObject->localToAbsoluteQ uad(FloatRect(localRect)).enclosingBoundingBox(); | 235 return localRect == IntRect() ? IntRect() : m_layoutObject->localToAbsoluteQ uad(FloatRect(localRect)).enclosingBoundingBox(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound& bound) const | 238 void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound& bound, bool selectionStart) const |
| 239 { | 239 { |
| 240 bound.layer = nullptr; | 240 bound.layer = nullptr; |
| 241 bound.edgeTopInLayer = bound.edgeBottomInLayer = FloatPoint(); | 241 bound.edgeTopInLayer = bound.edgeBottomInLayer = FloatPoint(); |
| 242 | 242 |
| 243 if (isNull()) | 243 if (isNull()) |
| 244 return; | 244 return; |
| 245 | 245 |
| 246 LayoutRect rect = m_layoutObject->localCaretRect(m_inlineBox, m_offset); | 246 LayoutRect rect = m_layoutObject->localCaretRect(m_inlineBox, m_offset); |
| 247 PaintLayer* layer = nullptr; | 247 PaintLayer* layer = nullptr; |
| 248 bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect. minXMinYCorner(), &layer); | 248 bool vertical = m_layoutObject->hasFlippedBlocksWritingMode() || m_layoutObj ect->style()->isFlippedLinesWritingMode(); |
|
kojii
2015/12/16 17:30:58
I think |!m_layoutObject->isHorizontalWritingMode(
aelias_OOO_until_Jul13
2016/01/08 02:24:12
Done. Note that I needed to do m_layoutObject->st
kojii
2016/01/08 04:16:51
It should have been set in LayoutBoxModelObject::u
| |
| 249 bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(re ct.minXMaxYCorner(), nullptr); | 249 if (!vertical) { |
| 250 bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(r ect.minXMinYCorner(), &layer); | |
| 251 bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoin t(rect.minXMaxYCorner(), nullptr); | |
| 252 } else { | |
| 253 bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(r ect.minXMinYCorner(), &layer); | |
| 254 bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoin t(rect.maxXMinYCorner(), nullptr); | |
| 255 | |
| 256 // When text is vertical, it looks better for the start handle baseline to | |
| 257 // be at the starting edge, to enclose the selection fully between the | |
| 258 // handles. | |
| 259 if (selectionStart) { | |
| 260 float xSwap = bound.edgeBottomInLayer.x(); | |
| 261 bound.edgeBottomInLayer.setX(bound.edgeTopInLayer.x()); | |
| 262 bound.edgeTopInLayer.setX(xSwap); | |
| 263 } | |
| 264 | |
| 265 // Flipped blocks writing mode is not only vertical but also right to le ft. | |
| 266 bound.isTextDirectionRTL = m_layoutObject->hasFlippedBlocksWritingMode() ; | |
| 267 } | |
| 268 | |
| 250 bound.layer = layer ? layer->graphicsLayerBacking() : nullptr; | 269 bound.layer = layer ? layer->graphicsLayerBacking() : nullptr; |
| 251 } | 270 } |
| 252 | 271 |
| 253 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position ) | 272 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position ) |
| 254 { | 273 { |
| 255 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) { | 274 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout Object && layoutObject->node(); layoutObject = layoutObject->parent()) { |
| 256 if (layoutObject == target) | 275 if (layoutObject == target) |
| 257 return true; | 276 return true; |
| 258 } | 277 } |
| 259 return false; | 278 return false; |
| 260 } | 279 } |
| 261 | 280 |
| 262 }; | 281 }; |
| OLD | NEW |