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

Side by Side Diff: third_party/WebKit/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: Rebase Created 5 years, 2 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 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 if (root->type() == ShadowRootType::UserAgent) { 2833 if (root->type() == ShadowRootType::UserAgent) {
2834 if (Element* shadowHost = node()->shadowHost()) { 2834 if (Element* shadowHost = node()->shadowHost()) {
2835 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION)); 2835 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2836 } 2836 }
2837 } 2837 }
2838 } 2838 }
2839 2839
2840 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2840 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2841 } 2841 }
2842 2842
2843 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2844 {
2845 LayoutObject* curr = this;
2846 const ComputedStyle* styleToUse = nullptr;
2847 unsigned currDecs = TextDecorationNone;
2848 Color resultColor;
2849 TextDecorationStyle resultStyle;
2850 do {
2851 styleToUse = curr->style(firstlineStyle);
2852 currDecs = styleToUse->textDecoration();
2853 currDecs &= decorations;
2854 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2855 resultStyle = styleToUse->textDecorationStyle();
2856 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2857 if (currDecs) {
2858 if (currDecs & TextDecorationUnderline) {
2859 decorations &= ~TextDecorationUnderline;
2860 underline.color = resultColor;
2861 underline.style = resultStyle;
2862 }
2863 if (currDecs & TextDecorationOverline) {
2864 decorations &= ~TextDecorationOverline;
2865 overline.color = resultColor;
2866 overline.style = resultStyle;
2867 }
2868 if (currDecs & TextDecorationLineThrough) {
2869 decorations &= ~TextDecorationLineThrough;
2870 linethrough.color = resultColor;
2871 linethrough.style = resultStyle;
2872 }
2873 }
2874 if (curr->isRubyText())
2875 return;
2876 curr = curr->parent();
2877 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2878 curr = toLayoutBlock(curr)->continuation();
2879 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2880
2881 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2882 if (decorations && curr) {
2883 styleToUse = curr->style(firstlineStyle);
2884 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2885 if (decorations & TextDecorationUnderline) {
2886 underline.color = resultColor;
2887 underline.style = resultStyle;
2888 }
2889 if (decorations & TextDecorationOverline) {
2890 overline.color = resultColor;
2891 overline.style = resultStyle;
2892 }
2893 if (decorations & TextDecorationLineThrough) {
2894 linethrough.color = resultColor;
2895 linethrough.style = resultStyle;
2896 }
2897 }
2898 }
2899
2900 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2843 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2901 { 2844 {
2902 // Convert the style regions to absolute coordinates. 2845 // Convert the style regions to absolute coordinates.
2903 if (style()->visibility() != VISIBLE || !isBox()) 2846 if (style()->visibility() != VISIBLE || !isBox())
2904 return; 2847 return;
2905 2848
2906 if (style()->getDraggableRegionMode() == DraggableRegionNone) 2849 if (style()->getDraggableRegionMode() == DraggableRegionNone)
2907 return; 2850 return;
2908 2851
2909 LayoutBox* box = toLayoutBox(this); 2852 LayoutBox* box = toLayoutBox(this);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 const blink::LayoutObject* root = object1; 3362 const blink::LayoutObject* root = object1;
3420 while (root->parent()) 3363 while (root->parent())
3421 root = root->parent(); 3364 root = root->parent();
3422 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3365 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3423 } else { 3366 } else {
3424 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3367 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3425 } 3368 }
3426 } 3369 }
3427 3370
3428 #endif 3371 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698