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

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, 1 month 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 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 if (root->type() == ShadowRootType::UserAgent) { 2882 if (root->type() == ShadowRootType::UserAgent) {
2883 if (Element* shadowHost = node()->shadowHost()) { 2883 if (Element* shadowHost = node()->shadowHost()) {
2884 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION)); 2884 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2885 } 2885 }
2886 } 2886 }
2887 } 2887 }
2888 2888
2889 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2889 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2890 } 2890 }
2891 2891
2892 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2893 {
2894 LayoutObject* curr = this;
2895 const ComputedStyle* styleToUse = nullptr;
2896 unsigned currDecs = TextDecorationNone;
2897 Color resultColor;
2898 TextDecorationStyle resultStyle;
2899 do {
2900 styleToUse = curr->style(firstlineStyle);
2901 currDecs = styleToUse->textDecoration();
2902 currDecs &= decorations;
2903 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2904 resultStyle = styleToUse->textDecorationStyle();
2905 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2906 if (currDecs) {
2907 if (currDecs & TextDecorationUnderline) {
2908 decorations &= ~TextDecorationUnderline;
2909 underline.color = resultColor;
2910 underline.style = resultStyle;
2911 }
2912 if (currDecs & TextDecorationOverline) {
2913 decorations &= ~TextDecorationOverline;
2914 overline.color = resultColor;
2915 overline.style = resultStyle;
2916 }
2917 if (currDecs & TextDecorationLineThrough) {
2918 decorations &= ~TextDecorationLineThrough;
2919 linethrough.color = resultColor;
2920 linethrough.style = resultStyle;
2921 }
2922 }
2923 if (curr->isRubyText())
2924 return;
2925 curr = curr->parent();
2926 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2927 curr = toLayoutBlock(curr)->continuation();
2928 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2929
2930 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2931 if (decorations && curr) {
2932 styleToUse = curr->style(firstlineStyle);
2933 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2934 if (decorations & TextDecorationUnderline) {
2935 underline.color = resultColor;
2936 underline.style = resultStyle;
2937 }
2938 if (decorations & TextDecorationOverline) {
2939 overline.color = resultColor;
2940 overline.style = resultStyle;
2941 }
2942 if (decorations & TextDecorationLineThrough) {
2943 linethrough.color = resultColor;
2944 linethrough.style = resultStyle;
2945 }
2946 }
2947 }
2948
2949 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2892 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2950 { 2893 {
2951 // Convert the style regions to absolute coordinates. 2894 // Convert the style regions to absolute coordinates.
2952 if (style()->visibility() != VISIBLE || !isBox()) 2895 if (style()->visibility() != VISIBLE || !isBox())
2953 return; 2896 return;
2954 2897
2955 if (style()->getDraggableRegionMode() == DraggableRegionNone) 2898 if (style()->getDraggableRegionMode() == DraggableRegionNone)
2956 return; 2899 return;
2957 2900
2958 LayoutBox* box = toLayoutBox(this); 2901 LayoutBox* box = toLayoutBox(this);
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 const blink::LayoutObject* root = object1; 3461 const blink::LayoutObject* root = object1;
3519 while (root->parent()) 3462 while (root->parent())
3520 root = root->parent(); 3463 root = root->parent();
3521 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3464 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3522 } else { 3465 } else {
3523 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3466 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3524 } 3467 }
3525 } 3468 }
3526 3469
3527 #endif 3470 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698