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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1328283005: Add support for multiple text decorations with same line positioning (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 5 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 if (root->type() == ShadowRootType::UserAgent) { 2805 if (root->type() == ShadowRootType::UserAgent) {
2806 if (Element* shadowHost = node()->shadowHost()) { 2806 if (Element* shadowHost = node()->shadowHost()) {
2807 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION)); 2807 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2808 } 2808 }
2809 } 2809 }
2810 } 2810 }
2811 2811
2812 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2812 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2813 } 2813 }
2814 2814
2815 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2816 {
2817 LayoutObject* curr = this;
2818 const ComputedStyle* styleToUse = nullptr;
2819 unsigned currDecs = TextDecorationNone;
2820 Color resultColor;
2821 TextDecorationStyle resultStyle;
2822 do {
2823 styleToUse = curr->style(firstlineStyle);
2824 currDecs = styleToUse->textDecoration();
2825 currDecs &= decorations;
2826 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2827 resultStyle = styleToUse->textDecorationStyle();
2828 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2829 if (currDecs) {
2830 if (currDecs & TextDecorationUnderline) {
2831 decorations &= ~TextDecorationUnderline;
2832 underline.color = resultColor;
2833 underline.style = resultStyle;
2834 }
2835 if (currDecs & TextDecorationOverline) {
2836 decorations &= ~TextDecorationOverline;
2837 overline.color = resultColor;
2838 overline.style = resultStyle;
2839 }
2840 if (currDecs & TextDecorationLineThrough) {
2841 decorations &= ~TextDecorationLineThrough;
2842 linethrough.color = resultColor;
2843 linethrough.style = resultStyle;
2844 }
2845 }
2846 if (curr->isRubyText())
2847 return;
2848 curr = curr->parent();
2849 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2850 curr = toLayoutBlock(curr)->continuation();
2851 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2852
2853 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2854 if (decorations && curr) {
2855 styleToUse = curr->style(firstlineStyle);
2856 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2857 if (decorations & TextDecorationUnderline) {
2858 underline.color = resultColor;
2859 underline.style = resultStyle;
2860 }
2861 if (decorations & TextDecorationOverline) {
2862 overline.color = resultColor;
2863 overline.style = resultStyle;
2864 }
2865 if (decorations & TextDecorationLineThrough) {
2866 linethrough.color = resultColor;
2867 linethrough.style = resultStyle;
2868 }
2869 }
2870 }
2871
2872 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2815 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2873 { 2816 {
2874 // Convert the style regions to absolute coordinates. 2817 // Convert the style regions to absolute coordinates.
2875 if (style()->visibility() != VISIBLE || !isBox()) 2818 if (style()->visibility() != VISIBLE || !isBox())
2876 return; 2819 return;
2877 2820
2878 if (style()->getDraggableRegionMode() == DraggableRegionNone) 2821 if (style()->getDraggableRegionMode() == DraggableRegionNone)
2879 return; 2822 return;
2880 2823
2881 LayoutBox* box = toLayoutBox(this); 2824 LayoutBox* box = toLayoutBox(this);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
3393 const blink::LayoutObject* root = object1; 3336 const blink::LayoutObject* root = object1;
3394 while (root->parent()) 3337 while (root->parent())
3395 root = root->parent(); 3338 root = root->parent();
3396 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3339 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3397 } else { 3340 } else {
3398 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3341 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3399 } 3342 }
3400 } 3343 }
3401 3344
3402 #endif 3345 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698