Changeset 200519 in webkit


Ignore:
Timestamp:
May 6, 2016 1:38:55 PM (8 years ago)
Author:
andersca@apple.com
Message:

Tidy up the LinkRelAttribute code
https://bugs.webkit.org/show_bug.cgi?id=157429

Reviewed by Sam Weinig.

Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
Remove the InvalidIcon enum declaration and use WTF::Optional instead.

  • WebCore.xcodeproj/project.pbxproj:
  • dom/IconURL.h: Removed.
  • html/HTMLLinkElement.cpp:

(WebCore::HTMLLinkElement::iconType):
(WebCore::HTMLLinkElement::addSubresourceAttributeURLs):

  • html/HTMLLinkElement.h:
  • html/LinkRelAttribute.cpp:

(WebCore::LinkRelAttribute::LinkRelAttribute):

  • html/LinkRelAttribute.h:
  • html/parser/HTMLPreloadScanner.cpp:

(WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):

  • loader/FrameLoader.h:
  • loader/FrameLoaderClient.h:
  • loader/icon/IconController.cpp:

(WebCore::iconFromLinkElements):

Location:
trunk/Source/WebCore
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r200516 r200519  
     12016-05-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Tidy up the LinkRelAttribute code
     4        https://bugs.webkit.org/show_bug.cgi?id=157429
     5
     6        Reviewed by Sam Weinig.
     7
     8        Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
     9        Remove the InvalidIcon enum declaration and use WTF::Optional instead.
     10
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * dom/IconURL.h: Removed.
     13        * html/HTMLLinkElement.cpp:
     14        (WebCore::HTMLLinkElement::iconType):
     15        (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
     16        * html/HTMLLinkElement.h:
     17        * html/LinkRelAttribute.cpp:
     18        (WebCore::LinkRelAttribute::LinkRelAttribute):
     19        * html/LinkRelAttribute.h:
     20        * html/parser/HTMLPreloadScanner.cpp:
     21        (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
     22        * loader/FrameLoader.h:
     23        * loader/FrameLoaderClient.h:
     24        * loader/icon/IconController.cpp:
     25        (WebCore::iconFromLinkElements):
     26
    1272016-05-06  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r200507 r200519  
    17301730                458FE4091589DF0B005609E6 /* RenderSearchField.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 458FE4071589DF0B005609E6 /* RenderSearchField.cpp */; };
    17311731                458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
    1732                 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17331732                45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
    17341733                45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    92739272                458FE4071589DF0B005609E6 /* RenderSearchField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSearchField.cpp; sourceTree = "<group>"; };
    92749273                458FE4081589DF0B005609E6 /* RenderSearchField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSearchField.h; sourceTree = "<group>"; };
    9275                 45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
    92769274                45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
    92779275                45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
     
    2440224400                                2442BBF81194C9D300D49469 /* HashChangeEvent.h */,
    2440324401                                8482B7441198C32E00BFB005 /* HashChangeEvent.idl */,
    24404                                 45BAC2AF1360BBAB005DA258 /* IconURL.h */,
    2440524402                                C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */,
    2440624403                                C3CF17A115B0063F00276D39 /* IdTargetObserver.h */,
     
    2633926336                                513F14540AB634C400094DDF /* IconLoader.h in Headers */,
    2634026337                                51E1ECC10C91C90400DC255B /* IconRecord.h in Headers */,
    26341                                 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */,
    2634226338                                51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */,
    2634326339                                C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */,
  • trunk/Source/WebCore/html/HTMLLinkElement.cpp

    r200041 r200519  
    496496}
    497497
    498 IconType HTMLLinkElement::iconType() const
     498Optional<LinkRelAttribute::IconType> HTMLLinkElement::iconType() const
    499499{
    500500    return m_relAttribute.iconType;
     
    511511
    512512    // Favicons are handled by a special case in LegacyWebArchive::create()
    513     if (m_relAttribute.iconType != InvalidIcon)
     513    if (m_relAttribute.iconType)
    514514        return;
    515515
  • trunk/Source/WebCore/html/HTMLLinkElement.h

    r199650 r200519  
    5555    const AtomicString& type() const;
    5656
    57     IconType iconType() const;
     57    Optional<LinkRelAttribute::IconType> iconType() const;
    5858
    5959    // the icon size string as parsed from the HTML attribute
  • trunk/Source/WebCore/html/LinkRelAttribute.cpp

    r199650 r200519  
    4747        isStyleSheet = true;
    4848    else if (equalLettersIgnoringASCIICase(rel, "icon") || equalLettersIgnoringASCIICase(rel, "shortcut icon"))
    49         iconType = Favicon;
    50 #if ENABLE(TOUCH_ICON_LOADING)
     49        iconType = IconType::Favicon;
    5150    else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon"))
    52         iconType = TouchIcon;
     51        iconType = IconType::TouchIcon;
    5352    else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon-precomposed"))
    54         iconType = TouchPrecomposedIcon;
    55 #endif
     53        iconType = IconType::TouchPrecomposedIcon;
    5654    else if (equalLettersIgnoringASCIICase(rel, "dns-prefetch"))
    5755        isDNSPrefetch = true;
     
    7371                isAlternate = true;
    7472            else if (equalLettersIgnoringASCIICase(word, "icon"))
    75                 iconType = Favicon;
    76 #if ENABLE(TOUCH_ICON_LOADING)
     73                iconType = IconType::Favicon;
    7774            else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon"))
    78                 iconType = TouchIcon;
     75                iconType = IconType::TouchIcon;
    7976            else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon-precomposed"))
    80                 iconType = TouchPrecomposedIcon;
    81 #endif
     77                iconType = IconType::TouchPrecomposedIcon;
    8278#if ENABLE(LINK_PREFETCH)
    8379            else if (equalLettersIgnoringASCIICase(word, "prefetch"))
  • trunk/Source/WebCore/html/LinkRelAttribute.h

    r199650 r200519  
    11/*
    22 * Copyright (C) 2011 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3031 */
    3132
    32 #ifndef LinkRelAttribute_h
    33 #define LinkRelAttribute_h
     33#pragma once
    3434
    35 #include "IconURL.h"
    3635#include <wtf/Forward.h>
     36#include <wtf/Optional.h>
    3737
    3838namespace WebCore {
    3939
    4040struct LinkRelAttribute {
     41    enum class IconType {
     42        Favicon,
     43        TouchIcon,
     44        TouchPrecomposedIcon,
     45    };
     46
    4147    bool isStyleSheet { false };
    42     IconType iconType { InvalidIcon };
     48    Optional<IconType> iconType;
    4349    bool isAlternate { false };
    4450    bool isDNSPrefetch { false };
     
    5460
    5561}
    56 
    57 #endif
  • trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp

    r200075 r200519  
    242242    {
    243243        LinkRelAttribute parsedAttribute { attributeValue };
    244         return parsedAttribute.isStyleSheet && !parsedAttribute.isAlternate && parsedAttribute.iconType == InvalidIcon && !parsedAttribute.isDNSPrefetch;
     244        return parsedAttribute.isStyleSheet && !parsedAttribute.isAlternate && !parsedAttribute.iconType && !parsedAttribute.isDNSPrefetch;
    245245    }
    246246
  • trunk/Source/WebCore/loader/FrameLoader.h

    r199612 r200519  
    3636#include "FrameLoaderStateMachine.h"
    3737#include "FrameLoaderTypes.h"
    38 #include "IconURL.h"
    3938#include "LayoutMilestones.h"
    4039#include "MixedContentChecker.h"
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r199673 r200519  
    3232
    3333#include "FrameLoaderTypes.h"
    34 #include "IconURL.h"
    3534#include "LayoutMilestones.h"
    3635#include "ResourceLoadPriority.h"
     
    5251#endif
    5352#endif
    54 
    55 typedef class _jobject* jobject;
    5653
    5754#if PLATFORM(COCOA)
  • trunk/Source/WebCore/loader/icon/IconController.cpp

    r183015 r200519  
    8080
    8181    for (auto& linkElement : childrenOfType<HTMLLinkElement>(*head)) {
    82         if (!(linkElement.iconType() & Favicon))
     82        if (!linkElement.iconType())
     83            continue;
     84        if (*linkElement.iconType() != LinkRelAttribute::IconType::Favicon)
    8385            continue;
    8486        if (linkElement.href().isEmpty())
Note: See TracChangeset for help on using the changeset viewer.